| 1 |
#pragma once |
| 2 |
|
| 3 |
/* |
| 4 |
* Private definitions |
| 5 |
* This file contains private definitions for the RB-Tree implementation, but |
| 6 |
* which are used by our test-suite. |
| 7 |
*/ |
| 8 |
|
| 9 |
#include <c-stdaux.h> |
| 10 |
#include <stddef.h> |
| 11 |
#include "c-rbtree.h" |
| 12 |
|
| 13 |
/* |
| 14 |
* Nodes |
| 15 |
*/ |
| 16 |
|
| 17 |
static inline void *c_rbnode_raw(CRBNode *n) { |
| 18 |
return (void *)(n->__parent_and_flags & ~C_RBNODE_FLAG_MASK); |
| 19 |
} |
| 20 |
|
| 21 |
static inline unsigned long c_rbnode_flags(CRBNode *n) { |
| 22 |
return n->__parent_and_flags & C_RBNODE_FLAG_MASK; |
| 23 |
} |
| 24 |
|
| 25 |
static inline _Bool c_rbnode_is_red(CRBNode *n) { |
| 26 |
return c_rbnode_flags(n) & C_RBNODE_RED; |
| 27 |
} |
| 28 |
|
| 29 |
static inline _Bool c_rbnode_is_black(CRBNode *n) { |
| 30 |
return !(c_rbnode_flags(n) & C_RBNODE_RED); |
| 31 |
} |
| 32 |
|
| 33 |
static inline _Bool c_rbnode_is_root(CRBNode *n) { |
| 34 |
return c_rbnode_flags(n) & C_RBNODE_ROOT; |
| 35 |
} |