Files
Toyota-AVC-LAN/src/queue.h
T
2026-05-15 18:28:54 -07:00

20 lines
618 B
C

#pragma once
#include <stdint.h>
typedef struct Queue_struct {
uint8_t write;
uint8_t read;
uint8_t size; // MUST be a power of 2 (qMask depends on it)
void **buf; // size entries, owned by caller
} Queue_t;
void constructQueue(Queue_t *q, void **slots, void *items, uint8_t itemSize,
uint8_t len, uint8_t constructFull);
void constructEmptyQueue(Queue_t *q, void **slots, uint8_t len);
uint8_t isEmpty(const Queue_t *q);
static inline void incrementRead(Queue_t *q) { q->read++; }
uint8_t pushQueue(Queue_t *q, void *x);
void *peekQueue(const Queue_t *q);
void *popQueue(Queue_t *q);