diff options
| author | Jason Evans <jasone@canonware.com> | 2016-04-06 20:05:21 (GMT) |
|---|---|---|
| committer | Jason Evans <jasone@canonware.com> | 2016-04-11 09:35:00 (GMT) |
| commit | 667eca2ac215153855e62a75263df7accf25cdbc (patch) | |
| tree | a35d99c3f2031d9a469801a052c12e1d12c3568a /include/jemalloc | |
| parent | 245ae6036c09cc11a72fab4335495d95cddd5beb (diff) | |
| download | jemalloc-667eca2ac215153855e62a75263df7accf25cdbc.zip jemalloc-667eca2ac215153855e62a75263df7accf25cdbc.tar.gz jemalloc-667eca2ac215153855e62a75263df7accf25cdbc.tar.bz2 | |
Simplify RTREE_HEIGHT_MAX definition.
Use 1U rather than ZU(1) in macro definitions, so that the preprocessor
can evaluate the resulting expressions.
Diffstat (limited to 'include/jemalloc')
| -rw-r--r-- | include/jemalloc/internal/rtree.h | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/include/jemalloc/internal/rtree.h b/include/jemalloc/internal/rtree.h index 36aa002..8d0c584 100644 --- a/include/jemalloc/internal/rtree.h +++ b/include/jemalloc/internal/rtree.h @@ -15,35 +15,10 @@ typedef struct rtree_s rtree_t; * machine address width. */ #define LG_RTREE_BITS_PER_LEVEL 4 -#define RTREE_BITS_PER_LEVEL (ZU(1) << LG_RTREE_BITS_PER_LEVEL) -/* - * Avoid math in RTREE_HEIGHT_MAX definition so that it can be used in cpp - * conditionals. The following defininitions are precomputed equivalents to: - * - * #define RTREE_HEIGHT_MAX \ - * ((ZU(1) << (LG_SIZEOF_PTR+3)) / RTREE_BITS_PER_LEVEL) - */ -#if LG_RTREE_BITS_PER_LEVEL == 2 -# if LG_SIZEOF_PTR == 3 -# define RTREE_HEIGHT_MAX 16 -# elif LG_SIZEOF_PTR == 2 -# define RTREE_HEIGHT_MAX 8 -# endif -#elif LG_RTREE_BITS_PER_LEVEL == 3 -# if LG_SIZEOF_PTR == 3 -# define RTREE_HEIGHT_MAX 8 -# elif LG_SIZEOF_PTR == 2 -# define RTREE_HEIGHT_MAX 4 -# endif -#elif LG_RTREE_BITS_PER_LEVEL == 4 -# if LG_SIZEOF_PTR == 3 -# define RTREE_HEIGHT_MAX 4 -# elif LG_SIZEOF_PTR == 2 -# define RTREE_HEIGHT_MAX 2 -# endif -#else -# error Unsupported LG_RTREE_BITS_PER_LEVEL -#endif +#define RTREE_BITS_PER_LEVEL (1U << LG_RTREE_BITS_PER_LEVEL) +/* Maximum rtree height. */ +#define RTREE_HEIGHT_MAX \ + ((1U << (LG_SIZEOF_PTR+3)) / RTREE_BITS_PER_LEVEL) /* Used for two-stage lock-free node initialization. */ #define RTREE_NODE_INITIALIZING ((rtree_node_elm_t *)0x1) |
