Fix assumption that pointers fits in a 'long'
Windows uses LLP64 model so [u]intptr_t is more correct.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/memalign.c b/memalign.c
index 87667b4..7a04ffd 100644
--- a/memalign.c
+++ b/memalign.c
@@ -1,5 +1,6 @@
#include <stdlib.h>
#include <assert.h>
+#include <inttypes.h>
#include "memalign.h"
@@ -8,7 +9,7 @@
};
#define PTR_ALIGN(ptr, mask) \
- (char *) (((unsigned long) ((ptr) + (mask)) & ~(mask)))
+ (char *) (((uintptr_t) ((ptr) + (mask)) & ~(mask)))
void *fio_memalign(size_t alignment, size_t size)
{
@@ -21,7 +22,7 @@
if (ptr) {
ret = PTR_ALIGN(ptr, alignment);
f = ret + size;
- f->offset = (unsigned long) ret - (unsigned long) ptr;
+ f->offset = (uintptr_t) ret - (uintptr_t) ptr;
}
return ret;