X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=tos%2Fsystem%2FQueueC.nc;h=ecf714aabed9f3c9221104001e4ce80cab0a74ab;hb=267875ef02b9446e463c6f48b0930694f1b86716;hp=3f8d378772a8126d30525918a7c1bae770625bcc;hpb=1e0af975a18cad955b40fc5b2edb211fc8233774;p=tinyos-2.x.git diff --git a/tos/system/QueueC.nc b/tos/system/QueueC.nc index 3f8d3787..ecf714aa 100644 --- a/tos/system/QueueC.nc +++ b/tos/system/QueueC.nc @@ -45,7 +45,7 @@ generic module QueueC(typedef queue_t, uint8_t QUEUE_SIZE) { implementation { - queue_t queue[QUEUE_SIZE]; + queue_t ONE_NOK queue[QUEUE_SIZE]; uint8_t head = 0; uint8_t tail = 0; uint8_t size = 0; @@ -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]; }