2 #ifdef JEMALLOC_H_TYPES
8 # define FMT64_PREFIX "ll"
9 # define FMTPTR_PREFIX "ll"
11 # define FMT64_PREFIX "ll"
12 # define FMTPTR_PREFIX ""
17 # define FMTd64 FMT64_PREFIX "d"
18 # define FMTu64 FMT64_PREFIX "u"
19 # define FMTx64 FMT64_PREFIX "x"
20 # define FMTdPTR FMTPTR_PREFIX "d"
21 # define FMTuPTR FMTPTR_PREFIX "u"
22 # define FMTxPTR FMTPTR_PREFIX "x"
24 # include <inttypes.h>
25 # define FMTd32 PRId32
26 # define FMTu32 PRIu32
27 # define FMTx32 PRIx32
28 # define FMTd64 PRId64
29 # define FMTu64 PRIu64
30 # define FMTx64 PRIx64
31 # define FMTdPTR PRIdPTR
32 # define FMTuPTR PRIuPTR
33 # define FMTxPTR PRIxPTR
42 #define BUFERROR_BUF 64
48 #define MALLOC_PRINTF_BUFSIZE 4096
51 #ifndef JEMALLOC_ALLOC_JUNK
52 # define JEMALLOC_ALLOC_JUNK ((uint8_t)0xa5)
54 #ifndef JEMALLOC_FREE_JUNK
55 # define JEMALLOC_FREE_JUNK ((uint8_t)0x5a)
62 #define JEMALLOC_ARG_CONCAT(...) __VA_ARGS__
69 #ifdef JEMALLOC_CC_SILENCE
70 # define JEMALLOC_CC_SILENCE_INIT(v) = v
72 # define JEMALLOC_CC_SILENCE_INIT(v)
76 # define likely(x) __builtin_expect(!!(x), 1)
77 # define unlikely(x) __builtin_expect(!!(x), 0)
79 # define likely(x) !!(x)
80 # define unlikely(x) !!(x)
83 #if !defined(JEMALLOC_INTERNAL_UNREACHABLE)
84 # error JEMALLOC_INTERNAL_UNREACHABLE should have been defined by configure
87 #define unreachable() JEMALLOC_INTERNAL_UNREACHABLE()
92 #define cassert(c) do { \
99 #ifdef JEMALLOC_H_STRUCTS
103 #ifdef JEMALLOC_H_EXTERNS
107 char **endptr,
int base);
128 #ifdef JEMALLOC_H_INLINES
130 #ifndef JEMALLOC_ENABLE_INLINE
131 unsigned ffs_llu(
unsigned long long bitmap);
132 unsigned ffs_lu(
unsigned long bitmap);
133 unsigned ffs_u(
unsigned bitmap);
134 unsigned ffs_zu(
size_t bitmap);
145 #if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_UTIL_C_))
148 #if !defined(JEMALLOC_INTERNAL_FFSLL) || !defined(JEMALLOC_INTERNAL_FFSL) \
149 || !defined(JEMALLOC_INTERNAL_FFS)
150 # error JEMALLOC_INTERNAL_FFS{,L,LL} should have been defined by configure
154 ffs_llu(
unsigned long long bitmap)
161 ffs_lu(
unsigned long bitmap)
168 ffs_u(
unsigned bitmap)
178 #if LG_SIZEOF_PTR == LG_SIZEOF_INT
179 return (
ffs_u(bitmap));
180 #elif LG_SIZEOF_PTR == LG_SIZEOF_LONG
182 #elif LG_SIZEOF_PTR == LG_SIZEOF_LONG_LONG
185 #error No implementation for size_t ffs()
193 #if LG_SIZEOF_LONG == 3
195 #elif LG_SIZEOF_LONG_LONG == 3
198 #error No implementation for 64-bit ffs()
206 #if LG_SIZEOF_INT == 2
207 return (
ffs_u(bitmap));
209 #error No implementation for 32-bit ffs()
211 return (
ffs_u(bitmap));
248 #if (LG_SIZEOF_PTR == 3)
255 #if (defined(__i386__) || defined(__amd64__) || defined(__x86_64__))
270 return ((
unsigned)ret);
272 #elif (defined(_MSC_VER))
280 #if (LG_SIZEOF_PTR == 3)
281 _BitScanReverse64(&ret,
x);
282 #elif (LG_SIZEOF_PTR == 2)
283 _BitScanReverse(&ret,
x);
285 # error "Unsupported type size for lg_floor()"
288 return ((
unsigned)ret);
290 #elif (defined(JEMALLOC_HAVE_BUILTIN_CLZ))
297 #if (LG_SIZEOF_PTR == LG_SIZEOF_INT)
299 #elif (LG_SIZEOF_PTR == LG_SIZEOF_LONG)
302 # error "Unsupported type size for lg_floor()"
317 #if (LG_SIZEOF_PTR == 3)
333 SetLastError(errnum);
345 return (GetLastError());
#define JEMALLOC_INTERNAL_FFSLL
#define JEMALLOC_INTERNAL_FFS
#define JEMALLOC_INTERNAL_FFSL
#define JEMALLOC_ALWAYS_INLINE
assert(limit<=UINT32_MAX/2)