* A general FIFO queue component, whose queue has a bounded size.
*
* @author Philip Levis
+ * @author Geoffrey Mainland
* @date $Date$
*/
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;
dbg("QueueC", "%s: size is %hhu\n", __FUNCTION__, size);
if (!call Queue.empty()) {
head++;
- head %= QUEUE_SIZE;
+ if (head == QUEUE_SIZE) head = 0;
size--;
printQueue();
}
dbg("QueueC", "%s: size is %hhu\n", __FUNCTION__, size);
queue[tail] = newVal;
tail++;
- tail %= QUEUE_SIZE;
+ if (tail == QUEUE_SIZE) tail = 0;
size++;
printQueue();
return SUCCESS;