diff options
-rw-r--r-- | collections/double_ended_queue.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/collections/double_ended_queue.c b/collections/double_ended_queue.c index 8a6a91e..285983b 100644 --- a/collections/double_ended_queue.c +++ b/collections/double_ended_queue.c @@ -127,7 +127,10 @@ deq *root; return NULL; } - return tmp = *(root->beg++); + tmp = *(root->beg++); + root->beg = (root->base + (root->beg - root->base) % root->limit); + + return tmp; } void* deq_index(root, index) |