From c925e6c219e6ae29ac724ff7c2dc17872d2a64c3 Mon Sep 17 00:00:00 2001 From: Michael Hope Date: Sun, 10 Oct 2010 20:07:34 +1300 Subject: Changed the ring_buffer indexes to uint16 to cut memory usage and increase capacity. Sorted struct members by size to improve the packing. --- libmaple/ring_buffer.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libmaple/ring_buffer.h b/libmaple/ring_buffer.h index 9628005..b4c136f 100644 --- a/libmaple/ring_buffer.h +++ b/libmaple/ring_buffer.h @@ -14,14 +14,14 @@ extern "C"{ * The total buffer size must be a power of two * One byte is left free to distinguish empty from full */ typedef struct ring_buffer { + /** Buffer items are stored into */ + volatile uint8 *buf; /** Index of the next item to remove */ - volatile uint32 head; + volatile uint16 head; /** Index where the next item will get inserted */ - volatile uint32 tail; + volatile uint16 tail; /** Buffer capacity */ - uint8 size; - /** Buffer items are stored into */ - volatile uint8 *buf; + uint16 size; } ring_buffer; /** Initialise a ring buffer. -- cgit v1.2.3