summaryrefslogtreecommitdiff
path: root/orc-test
diff options
context:
space:
mode:
authorDavid Schleef <ds@schleef.org>2012-04-01 15:31:05 -0700
committerDavid Schleef <ds@schleef.org>2012-04-01 16:01:47 -0700
commitfb5e8c5d30a06b149b22d7b33f398b826a47e7f0 (patch)
treef6ab786ec22f96c69a8bd52a819a95c13d4fd6c9 /orc-test
parentf3d0f49ace5ddc564404a6b8d3b23eaeffb3d3cd (diff)
test: allocate aligned memory on windows
Diffstat (limited to 'orc-test')
-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);