summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--orc-test/orcarray.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/orc-test/orcarray.c b/orc-test/orcarray.c
index 729593b..992e888 100644
--- a/orc-test/orcarray.c
+++ b/orc-test/orcarray.c
@@ -67,13 +67,15 @@ orc_array_new (int n, int m, int element_size, int misalignment,
MAP_FIXED|MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
idx++;
#else
-#ifdef HAVE_POSIX_MEMALIGN
+#ifdef HAVE_POSIX_MEMALIGNx
ret = posix_memalign (&data, ALIGNMENT, ar->alloc_len);
+ ar->alloc_data = data;
#else
- data = malloc (ar->alloc_len);
+ data = malloc (ar->alloc_len + ALIGNMENT);
+ ar->alloc_data = data;
+ data = (void *)((((unsigned long)data) + (ALIGNMENT-1))&(~(ALIGNMENT-1)));
#endif
#endif
- ar->alloc_data = data;
if (alignment == 0) alignment = element_size;
offset = (alignment * misalignment) & (ALIGNMENT - 1);