Compiler flags: -O3 -Wfatal-errors -Wall -std=c11
Library for creating and manage queues.
iqueue_init
: initializes the structure.iqueue_enqueue
: puts an element at the end of the queue.iqueue_dequque
: takes out the first element of the queue.iqueue_size
: gets the size of the queue (number of elements).iqueue_advance_next
: advances a position in the queue.iqueue_get_next_enqueue
: returns the next element of the queue.iqueue_dequeue_fast
: returns the first element of the queue.
- Include the header file
lib_iqueue.h
. - Create a
iqueue_t
instance. - Initialize the queue using
iqueue_init
typedef struct
{
uint8_t a[8];
uint8_t b[8];
}data_t;
...
...
uint8_t storage[256];
iqueue_t queue;
...
...
iqueue_init(&queue, 16, sizeof(data_t), storage);
...
...
data_t d;
iqueue_enqueue(&queue,&d);
...
...
data_t r;
iqueue_dequeue(&queue,&r);