blktrace: use for_each_file() instead of open coding the loop
[fio.git] / memalign.c
index 87667b42c35c7bea3f5d4c5d3e3a7a60c8a94539..7a04ffd8c31aa38443034fa300942bb8adf2259e 100644 (file)
@@ -1,5 +1,6 @@
 #include <stdlib.h>
 #include <assert.h>
+#include <inttypes.h>
 
 #include "memalign.h"
 
@@ -8,7 +9,7 @@ struct align_footer {
 };
 
 #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 @@ void *fio_memalign(size_t alignment, size_t size)
        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;