Assert compact color bit is unused
Signed-off-by: Joshua Kahn <jkahn@barracuda.com> This resolves #280.
This commit is contained in:
parent
f97298bfc1
commit
bd418ce11e
@ -79,6 +79,15 @@ struct { \
|
|||||||
(a_node)->a_field.rbn_right_red = (a_type *) (((intptr_t) \
|
(a_node)->a_field.rbn_right_red = (a_type *) (((intptr_t) \
|
||||||
(a_node)->a_field.rbn_right_red) & ((ssize_t)-2)); \
|
(a_node)->a_field.rbn_right_red) & ((ssize_t)-2)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
/* Node initializer. */
|
||||||
|
#define rbt_node_new(a_type, a_field, a_rbt, a_node) do { \
|
||||||
|
/* Bookkeeping bit cannot be used by node pointer. */ \
|
||||||
|
assert(((uintptr_t)(a_node) & 0x1) == 0); \
|
||||||
|
rbtn_left_set(a_type, a_field, (a_node), &(a_rbt)->rbt_nil); \
|
||||||
|
rbtn_right_set(a_type, a_field, (a_node), &(a_rbt)->rbt_nil); \
|
||||||
|
rbtn_red_set(a_type, a_field, (a_node)); \
|
||||||
|
} while (0)
|
||||||
#else
|
#else
|
||||||
/* Right accessors. */
|
/* Right accessors. */
|
||||||
#define rbtn_right_get(a_type, a_field, a_node) \
|
#define rbtn_right_get(a_type, a_field, a_node) \
|
||||||
@ -99,7 +108,6 @@ struct { \
|
|||||||
#define rbtn_black_set(a_type, a_field, a_node) do { \
|
#define rbtn_black_set(a_type, a_field, a_node) do { \
|
||||||
(a_node)->a_field.rbn_red = false; \
|
(a_node)->a_field.rbn_red = false; \
|
||||||
} while (0)
|
} while (0)
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Node initializer. */
|
/* Node initializer. */
|
||||||
#define rbt_node_new(a_type, a_field, a_rbt, a_node) do { \
|
#define rbt_node_new(a_type, a_field, a_rbt, a_node) do { \
|
||||||
@ -107,6 +115,7 @@ struct { \
|
|||||||
rbtn_right_set(a_type, a_field, (a_node), &(a_rbt)->rbt_nil); \
|
rbtn_right_set(a_type, a_field, (a_node), &(a_rbt)->rbt_nil); \
|
||||||
rbtn_red_set(a_type, a_field, (a_node)); \
|
rbtn_red_set(a_type, a_field, (a_node)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Tree initializer. */
|
/* Tree initializer. */
|
||||||
#define rb_new(a_type, a_field, a_rbt) do { \
|
#define rb_new(a_type, a_field, a_rbt) do { \
|
||||||
|
Loading…
Reference in New Issue
Block a user