aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Hope <michael.hope@linaro.org>2010-10-10 20:07:34 +1300
committerMichael Hope <michael.hope@linaro.org>2010-10-10 20:07:34 +1300
commitc925e6c219e6ae29ac724ff7c2dc17872d2a64c3 (patch)
tree095e5710e60794b9bf7aa3143bca6cfd467e30e1
parent0ed51a1b7bd35102099e5c27f042b27631649f0b (diff)
downloadlibrambutan-c925e6c219e6ae29ac724ff7c2dc17872d2a64c3.tar.gz
librambutan-c925e6c219e6ae29ac724ff7c2dc17872d2a64c3.zip
Changed the ring_buffer indexes to uint16 to cut memory usage and increase capacity. Sorted struct members by size to improve the packing.
-rw-r--r--libmaple/ring_buffer.h10
1 files 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.