From b38bcd56356973a50797630f8366d6701dd7c988 Mon Sep 17 00:00:00 2001 From: Tucker Evans Date: Wed, 10 Jun 2020 12:55:33 -0400 Subject: Add set index function for double ended queue. --- collections/double_ended_queue.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'collections/double_ended_queue.c') 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; -- cgit v1.1