diff options
author | Jason Evans <je@fb.com> | 2012-04-04 22:24:01 (GMT) |
---|---|---|
committer | Jason Evans <je@fb.com> | 2012-04-04 22:24:01 (GMT) |
commit | bbe53b1c16d523d3c70cf8e942249f7d76f90e73 (patch) | |
tree | 460cc87d10a23fb58a52aac7696c2a719749dccd /include | |
parent | 3cc1f1aa6981d6647aa01cec725fb2c134c1b0e9 (diff) | |
download | jemalloc-bbe53b1c16d523d3c70cf8e942249f7d76f90e73.zip jemalloc-bbe53b1c16d523d3c70cf8e942249f7d76f90e73.tar.gz jemalloc-bbe53b1c16d523d3c70cf8e942249f7d76f90e73.tar.bz2 |
Revert "Use ffsl() in ALLOCM_ALIGN()."
This reverts commit 722b370399fd6734de6781285ce9a0cffd547bdd.
Unfortunately, glibc requires _GNU_SOURCE to be defined before including
string.h, but there is no reliable way to get the prototype within
jemalloc.h unless _GNU_SOURCE was already defined.
Diffstat (limited to 'include')
-rw-r--r-- | include/jemalloc/jemalloc.h.in | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/jemalloc/jemalloc.h.in b/include/jemalloc/jemalloc.h.in index 8825a94..f0581db 100644 --- a/include/jemalloc/jemalloc.h.in +++ b/include/jemalloc/jemalloc.h.in @@ -4,6 +4,7 @@ extern "C" { #endif +#include <limits.h> #include <strings.h> #define JEMALLOC_VERSION "@jemalloc_version@" @@ -17,7 +18,11 @@ extern "C" { #ifdef JEMALLOC_EXPERIMENTAL #define ALLOCM_LG_ALIGN(la) (la) -#define ALLOCM_ALIGN(a) (ffsl(a)-1) +#if LG_SIZEOF_PTR == 2 +#define ALLOCM_ALIGN(a) (ffs(a)-1) +#else +#define ALLOCM_ALIGN(a) ((a < (size_t)INT_MAX) ? ffs(a)-1 : ffs(a>>32)+31) +#endif #define ALLOCM_ZERO ((int)0x40) #define ALLOCM_NO_MOVE ((int)0x80) |