| US 7,499,399 B2 | ||
| Method and system to determine whether a circular queue is empty or full | ||
| Alok Kumar, Santa Clara, Calif. (US); and Uday R. Naik, Fremont, Calif. (US) | ||
| Assigned to Intel Corporation, Santa Clara, Calif. (US) | ||
| Filed on Dec. 12, 2003, as Appl. No. 10/735,146. | ||
| Prior Publication US 2005/0129046 A1, Jun. 16, 2005 | ||
| Int. Cl. H04L 12/26 (2006.01) | ||
| U.S. Cl. 370—232 [370/412; 709/213] | 23 Claims |

| 1. A method, comprising:
determining a new enqueue slot of a circular queue having N slots into which a queue element may be enqueued;
setting a last enqueue slot (“LES”) pointer currently designating an old enqueue slot to designate the new enqueue slot after
determining the new enqueue slot;
determining whether the circular queue is full via executing a check comparing relative positions of the new enqueue slot
and a current dequeue slot (“CDS”), wherein the check determines whether enqueuing the queue element into the new enqueue
slot would result in an overflow condition of the circular queue;
dropping the queue element, if the ovefflow condition would result from enqueuing the queue element into the new enqueue slot;
resetting the LES pointer to designate the old enqueue slot, if the overflow condition would result from enqueuing the queue
element; and
enqueuing the queue element into the new enqueue slot, if the circular queue is not full.
|