1 #ifndef JEMALLOC_INTERNAL_UTIL_H
2 #define JEMALLOC_INTERNAL_UTIL_H
4 #define UTIL_INLINE static inline
6 /* Junk fill patterns. */
7 #ifndef JEMALLOC_ALLOC_JUNK
8 # define JEMALLOC_ALLOC_JUNK ((uint8_t)0xa5)
10 #ifndef JEMALLOC_FREE_JUNK
11 # define JEMALLOC_FREE_JUNK ((uint8_t)0x5a)
15 * Wrap a cpp argument that contains commas such that it isn't broken up into
18 #define JEMALLOC_ARG_CONCAT(...) __VA_ARGS__
20 /* cpp macro definition stringification. */
21 #define STRINGIFY_HELPER(x) #x
22 #define STRINGIFY(x) STRINGIFY_HELPER(x)
25 * Silence compiler warnings due to uninitialized values. This is used
26 * wherever the compiler fails to recognize that the variable is never used
29 #define JEMALLOC_CC_SILENCE_INIT(v) = v
32 # define likely(x) __builtin_expect(!!(x), 1)
33 # define unlikely(x) __builtin_expect(!!(x), 0)
35 # define likely(x) !!(x)
36 # define unlikely(x) !!(x)
39 #if !defined(JEMALLOC_INTERNAL_UNREACHABLE)
40 # error JEMALLOC_INTERNAL_UNREACHABLE should have been defined by configure
43 #define unreachable() JEMALLOC_INTERNAL_UNREACHABLE()
47 set_errno(int errnum) {
55 /* Get last error code. */
59 return GetLastError();
67 #endif /* JEMALLOC_INTERNAL_UTIL_H */