diff options
author | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-05-08 16:41:23 +0000 |
---|---|---|
committer | Andree Buschmann <AndreeBuschmann@t-online.de> | 2011-05-08 16:41:23 +0000 |
commit | e720724b9545bcfaf5a98b8a76b145a97a88b9f1 (patch) | |
tree | 3bdfc814ed3198bd51d67ca50ea933d962ffcb03 | |
parent | 9c33dca6479d41d1745e6007bca97fe11c9b8db1 (diff) | |
download | rockbox-e720724b9545bcfaf5a98b8a76b145a97a88b9f1.tar.gz rockbox-e720724b9545bcfaf5a98b8a76b145a97a88b9f1.zip |
Use MEM_ALIGN_ATTR and CACHEALIGN_SIZE in oggmalloc to ensure optimal alignment.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29833 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/codecs/libtremor/oggmalloc.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/apps/codecs/libtremor/oggmalloc.c b/apps/codecs/libtremor/oggmalloc.c index 3d60370641..3a5fecf910 100644 --- a/apps/codecs/libtremor/oggmalloc.c +++ b/apps/codecs/libtremor/oggmalloc.c | |||
@@ -61,7 +61,7 @@ void ogg_free(void* ptr) | |||
61 | } | 61 | } |
62 | 62 | ||
63 | /* Allocate IRAM buffer */ | 63 | /* Allocate IRAM buffer */ |
64 | static unsigned char iram_buff[IRAM_IBSS_SIZE] IBSS_ATTR __attribute__ ((aligned (16))); | 64 | static unsigned char iram_buff[IRAM_IBSS_SIZE] IBSS_ATTR MEM_ALIGN_ATTR; |
65 | static size_t iram_remain; | 65 | static size_t iram_remain; |
66 | 66 | ||
67 | void iram_malloc_init(void){ | 67 | void iram_malloc_init(void){ |
@@ -70,14 +70,13 @@ void iram_malloc_init(void){ | |||
70 | 70 | ||
71 | void *iram_malloc(size_t size){ | 71 | void *iram_malloc(size_t size){ |
72 | void* x; | 72 | void* x; |
73 | 73 | ||
74 | /* always ensure 16-byte aligned */ | 74 | /* always ensure alignment to CACHEALIGN_SIZE byte */ |
75 | if(size&0x0f) | 75 | size = (size + (CACHEALIGN_SIZE-1)) & ~(CACHEALIGN_SIZE-1); |
76 | size=(size-(size&0x0f))+16; | 76 | |
77 | |||
78 | if(size>iram_remain) | 77 | if(size>iram_remain) |
79 | return NULL; | 78 | return NULL; |
80 | 79 | ||
81 | x = &iram_buff[IRAM_IBSS_SIZE-iram_remain]; | 80 | x = &iram_buff[IRAM_IBSS_SIZE-iram_remain]; |
82 | iram_remain-=size; | 81 | iram_remain-=size; |
83 | 82 | ||