From c1a5b98641b7321cab2b7488da5be440d549d920 Mon Sep 17 00:00:00 2001 From: Marko Kreen Date: Tue, 7 Apr 2009 09:31:41 +0000 Subject: [PATCH] Fix broken alignment in src/slab.c Alignment macro was buggy, thus resulting in bad alignment. This means speed hit on x86, but may result in crashes on arches which are strict on alignment, unless the macro is pre-defined in OS headers. No problems from the field have been reported, thus maybe even the bad alignment happened to be aligned? --- src/slab.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/slab.c b/src/slab.c index 0addea0..e62bd1d 100644 --- a/src/slab.c +++ b/src/slab.c @@ -27,7 +27,7 @@ #include "bouncer.h" -#define CUSTOM_ALIGN(x, a) (((unsigned long)(x) + (a)) & ~(a)) +#define CUSTOM_ALIGN(x, a) (((unsigned long)(x) + ((a) - 1)) & ~((a) - 1)) #ifndef ALIGN #define ALIGN(x) CUSTOM_ALIGN(x, sizeof(long)) -- 2.39.5