Simplify RTREE_HEIGHT_MAX definition.
Use 1U rather than ZU(1) in macro definitions, so that the preprocessor can evaluate the resulting expressions.
This commit is contained in:
parent
245ae6036c
commit
667eca2ac2
@ -15,35 +15,10 @@ typedef struct rtree_s rtree_t;
|
|||||||
* machine address width.
|
* machine address width.
|
||||||
*/
|
*/
|
||||||
#define LG_RTREE_BITS_PER_LEVEL 4
|
#define LG_RTREE_BITS_PER_LEVEL 4
|
||||||
#define RTREE_BITS_PER_LEVEL (ZU(1) << LG_RTREE_BITS_PER_LEVEL)
|
#define RTREE_BITS_PER_LEVEL (1U << LG_RTREE_BITS_PER_LEVEL)
|
||||||
/*
|
/* Maximum rtree height. */
|
||||||
* Avoid math in RTREE_HEIGHT_MAX definition so that it can be used in cpp
|
#define RTREE_HEIGHT_MAX \
|
||||||
* conditionals. The following defininitions are precomputed equivalents to:
|
((1U << (LG_SIZEOF_PTR+3)) / RTREE_BITS_PER_LEVEL)
|
||||||
*
|
|
||||||
* #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
|
|
||||||
|
|
||||||
/* Used for two-stage lock-free node initialization. */
|
/* Used for two-stage lock-free node initialization. */
|
||||||
#define RTREE_NODE_INITIALIZING ((rtree_node_elm_t *)0x1)
|
#define RTREE_NODE_INITIALIZING ((rtree_node_elm_t *)0x1)
|
||||||
|
Loading…
Reference in New Issue
Block a user