diff options
Diffstat (limited to 'include/fifo.h')
-rw-r--r-- | include/fifo.h | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/include/fifo.h b/include/fifo.h index 5fec62f..1af51ec 100644 --- a/include/fifo.h +++ b/include/fifo.h @@ -6,40 +6,40 @@ #define FIFO_LEN 32 struct fifo { - u8 head; - u8 tail; - u8 data[FIFO_LEN]; + u8 head; + u8 tail; + u8 data[FIFO_LEN]; }; static inline u8 fifo_pop(struct fifo *fifo) { - u8 ret = fifo->data[fifo->head]; - if (++fifo->head >= LENGTH(fifo->data)) - fifo->head = 0; - return ret; + u8 ret = fifo->data[fifo->head]; + if (++fifo->head >= LENGTH(fifo->data)) + fifo->head = 0; + return ret; } static inline void fifo_push(struct fifo *fifo, u8 v) { - fifo->data[fifo->tail] = v; + fifo->data[fifo->tail] = v; - if (++fifo->tail >= LENGTH(fifo->data)) - fifo->tail = 0; + if (++fifo->tail >= LENGTH(fifo->data)) + fifo->tail = 0; } static inline bool fifo_empty(const struct fifo *fifo) { - return (fifo->head == fifo->tail); + return (fifo->head == fifo->tail); } static inline void fifo_clear(struct fifo *fifo) { - fifo->head = 0; - fifo->tail = 0; + fifo->head = 0; + fifo->tail = 0; } #endif // FIFO_H |