Update compression documentation
[fio.git] / lib / memalign.c
index cfd6e463ff924682d44346d130283094b7de3a07..bfbd1e80c851da90410dfbf0565849ce725f3193 100644 (file)
@@ -4,13 +4,13 @@
 
 #include "memalign.h"
 
+#define PTR_ALIGN(ptr, mask)   \
+       (char *)((uintptr_t)((ptr) + (mask)) & ~(mask))
+
 struct align_footer {
        unsigned int offset;
 };
 
-#define PTR_ALIGN(ptr, mask)   \
-       (char *) (((uintptr_t) ((ptr) + (mask)) & ~(mask)))
-
 void *fio_memalign(size_t alignment, size_t size)
 {
        struct align_footer *f;
@@ -18,7 +18,7 @@ void *fio_memalign(size_t alignment, size_t size)
 
        assert(!(alignment & (alignment - 1)));
 
-       ptr = malloc(size + alignment + size + sizeof(*f) - 1);
+       ptr = malloc(size + alignment + sizeof(*f) - 1);
        if (ptr) {
                ret = PTR_ALIGN(ptr, alignment - 1);
                f = ret + size;