From acc63f2712ddbccfcbbd1058b9d579d9ba166cd2 Mon Sep 17 00:00:00 2001 From: scipio Date: Thu, 25 Jun 2009 18:37:24 +0000 Subject: [PATCH] Remove modulo for inequality: does not require expensive op. --- tos/system/QueueC.nc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tos/system/QueueC.nc b/tos/system/QueueC.nc index 92a14fc6..ecf714aa 100644 --- a/tos/system/QueueC.nc +++ b/tos/system/QueueC.nc @@ -111,7 +111,9 @@ implementation { command queue_t Queue.element(uint8_t idx) { idx += head; - idx %= QUEUE_SIZE; + if (idx >= QUEUE_SIZE) { + idx -= QUEUE_SIZE; + } return queue[idx]; } -- 2.39.2