commit 7224db2bc059ef958349eae79912bc9f229116e0
parent d1c207e1c9cc8653afc01b989428e8d4370900df
Author: vaplv <vaplv@free.fr>
Date: Mon, 23 Feb 2015 10:01:12 +0100
Aligned the dynamic array data at least on 16 Bytes
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/dynamic_array.h b/src/dynamic_array.h
@@ -55,7 +55,7 @@
struct DARRAY_TYPE__ {
DARRAY_DATA* data;
/* Avoids alloc on small arrays */
- char ALIGN(ALIGNOF(DARRAY_DATA)) buf[16*sizeof(DARRAY_DATA)];
+ char ALIGN(MMIN(ALIGNOF(DARRAY_DATA), 16)) buf[16*sizeof(DARRAY_DATA)];
size_t size;
size_t capacity;
struct mem_allocator* allocator;
@@ -147,7 +147,7 @@ DARRAY_FUNC__(reserve)(struct DARRAY_TYPE__* darray, const size_t sz)
data = MEM_ALLOC_ALIGNED
(darray->allocator,
sz_adjusted * sizeof(DARRAY_DATA),
- ALIGNOF(DARRAY_DATA));
+ MMIN(ALIGNOF(DARRAY_DATA), 16));
if(!data)
return RES_MEM_ERR;