#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
Go to the source code of this file.
#define as_queue_inita |
( |
|
__q, |
|
|
|
__item_size, |
|
|
|
__capacity |
|
) |
| |
Value:(__q)->
data = alloca((__capacity) * (__item_size));\
(__q)->capacity = __capacity;\
(__q)->head = (__q)->tail = 0;\
(__q)->item_size = __item_size;\
(__q)->total = 0;\
(__q)->flags = 0;
Initialize a stack allocated as_queue, with item storage on the stack. as_queue_inita() will transfer stack memory to the heap if a resize is required.
Definition at line 81 of file as_queue.h.
as_queue* as_queue_create |
( |
uint32_t |
item_size, |
|
|
uint32_t |
capacity |
|
) |
| |
Create a heap allocated as_queue, with item storage on the heap.
static void as_queue_decr_total |
( |
as_queue * |
queue | ) |
|
|
inlinestatic |
void as_queue_destroy |
( |
as_queue * |
queue | ) |
|
static bool as_queue_empty |
( |
as_queue * |
queue | ) |
|
|
inlinestatic |
static bool as_queue_incr_total |
( |
as_queue * |
queue | ) |
|
|
inlinestatic |
bool as_queue_init |
( |
as_queue * |
queue, |
|
|
uint32_t |
item_size, |
|
|
uint32_t |
capacity |
|
) |
| |
Initialize a stack allocated as_queue, with item storage on the heap.
bool as_queue_pop |
( |
as_queue * |
queue, |
|
|
void * |
ptr |
|
) |
| |
Pop from the head of the queue.
bool as_queue_push |
( |
as_queue * |
queue, |
|
|
const void * |
ptr |
|
) |
| |
Push to the tail of the queue.
bool as_queue_push_head |
( |
as_queue * |
queue, |
|
|
const void * |
ptr |
|
) |
| |
Push to the front of the queue.
bool as_queue_push_limit |
( |
as_queue * |
queue, |
|
|
const void * |
ptr |
|
) |
| |
Push element on the queue only if size < capacity.
static uint32_t as_queue_size |
( |
as_queue * |
queue | ) |
|
|
inlinestatic |