LIFO buffer API, read long description carefully. More...
LIFO buffer API, read long description carefully.
This LIFO implementation very efficiently handles integer values. The caveat is that it can only handle values between 0 and its own size - 1. Also it can only handle up to one element of each value. If you insert a value twice the LIFO will break.
Definition in file lifo.h.
Go to the source code of this file.
int | lifo_empty (int *array) |
Check if the given lifo is empty. More... | |
void | lifo_init (int *array, int n) |
Initialize a lifo array. More... | |
void | lifo_insert (int *array, int i) |
Insert an element into the lifo. More... | |
int | lifo_get (int *array) |
Extract the least recently inserted element from the lifo. More... | |
int lifo_empty | ( | int * | array | ) |
Check if the given lifo is empty.
[in] | array | The lifo array to check. |
int lifo_get | ( | int * | array | ) |
Extract the least recently inserted element from the lifo.
array != NULL
[in] | array | An integer array. Must not be NULL. |
void lifo_init | ( | int * | array, |
int | n | ||
) |
Initialize a lifo array.
array != NULL
[in,out] | array | An array of size n + 1. Must not be NULL . |
[in] | n | Maximum integer value the lifo is able to store. |
void lifo_insert | ( | int * | array, |
int | i | ||
) |
Insert an element into the lifo.
array != NULL
[in,out] | array | An integer array of least i + 1 size that **does not already contain *i***. Must not be NULL . |
[in] | i | The integer value to store, between 0 and the size of the array - 1, must not be stored already. |