[commtech] Fix idx test in c_cache technique.

c_cache watching status value when idx % BUF_SIZE != 0 instead of when
it's equal zero.
This commit is contained in:
Thomas Preud'homme 2011-01-03 11:35:42 +01:00
parent 9f5fb833d7
commit 2d879dc3fc
1 changed files with 2 additions and 2 deletions

View File

@ -82,11 +82,11 @@ void *recv_one_data(void)
static __thread int i;
void *result;
if (unlikely(i % (BUF_SIZE / sizeof(void *))))
if (unlikely(!(i % (BUF_SIZE / sizeof(void *)))))
while (!comm.cons->channel->state);
result = (void *) comm.cons->channel->buf[i++];
i %= (2 * BUF_SIZE) / sizeof(void *);
if (unlikely(i % (BUF_SIZE / sizeof(void *))))
if (unlikely(!(i % (BUF_SIZE / sizeof(void *)))))
comm.cons->channel->state = 0;
return result;
}