diff options
author | Tucker Evans <tucker@tuckerevans.com> | 2020-06-10 12:55:33 -0400 |
---|---|---|
committer | Tucker Evans <tucker@tuckerevans.com> | 2020-06-10 12:55:33 -0400 |
commit | b38bcd56356973a50797630f8366d6701dd7c988 (patch) | |
tree | 8d1f819426d4d1a3417aca523798934740c25d37 /collections/double_ended_queue.c | |
parent | ce6d7f43e7ad77b3eec043ff731d17ab21e89e87 (diff) |
Add set index function for double ended queue.
Diffstat (limited to 'collections/double_ended_queue.c')
-rw-r--r-- | collections/double_ended_queue.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/collections/double_ended_queue.c b/collections/double_ended_queue.c index e737d28..232fb44 100644 --- a/collections/double_ended_queue.c +++ b/collections/double_ended_queue.c @@ -101,6 +101,16 @@ deq *root; root->base = tmp; } +void deq_set(root, index, item) +deq *root; +int index; +void *item; +{ + if (!root || !DEQ_IN_BOUNDS(root, index)) + return; + root->base[(root->beg + index) % root->limit] = item; +} + void* deq_index(root, index) deq *root; int index; |