From d6c381508ec4b98394e087b40a537e40d03c239c Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Tue, 1 Aug 2006 09:43:14 +0000 Subject: [PATCH] Always align allocated buffers on 32-bit boundaries git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10391 a1c6a512-1295-4272-9138-f99709370657 --- firmware/buffer.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/firmware/buffer.c b/firmware/buffer.c index d89d30b6ba..1eaff33de1 100644 --- a/firmware/buffer.c +++ b/firmware/buffer.c @@ -31,7 +31,8 @@ unsigned char *audiobuf; void buffer_init(void) { - audiobuf = audiobuffer; + /* 32-bit aligned */ + audiobuf = (void *)(((unsigned long)audiobuffer + 3) & ~3); } void *buffer_alloc(size_t size) @@ -39,5 +40,7 @@ void *buffer_alloc(size_t size) void *retval = audiobuf; audiobuf += size; + /* 32-bit aligned */; + audiobuf = (void *)(((unsigned long)audiobuf + 3) & ~3); return retval; }