diff options
| author | Sebastien Bacher <seb128@ubuntu.com> | 2019-01-25 11:24:41 +0100 |
|---|---|---|
| committer | Sebastien Bacher <seb128@ubuntu.com> | 2019-01-25 11:24:41 +0100 |
| commit | bbae86d3d2997a853ca0365e8eb7a3ca7489ee09 (patch) | |
| tree | 1f7fa49b47ab13aea3effbe839559d221f6323b4 /shared/c-rbtree/src/c-rbtree-private.h | |
| parent | 404ebe62622150e77e311777dff8617eb974e834 (diff) | |
New upstream version 1.15.2
Diffstat (limited to 'shared/c-rbtree/src/c-rbtree-private.h')
| -rw-r--r-- | shared/c-rbtree/src/c-rbtree-private.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/shared/c-rbtree/src/c-rbtree-private.h b/shared/c-rbtree/src/c-rbtree-private.h new file mode 100644 index 00000000..25b9ba01 --- /dev/null +++ b/shared/c-rbtree/src/c-rbtree-private.h @@ -0,0 +1,40 @@ +#pragma once + +/* + * Private definitions + * This file contains private definitions for the RB-Tree implementation, but + * which are used by our test-suite. + */ + +#include <stddef.h> +#include "c-rbtree.h" + +/* + * Macros + */ + +#define _public_ __attribute__((__visibility__("default"))) + +/* + * Nodes + */ + +static inline void *c_rbnode_raw(CRBNode *n) { + return (void *)(n->__parent_and_flags & ~C_RBNODE_FLAG_MASK); +} + +static inline unsigned long c_rbnode_flags(CRBNode *n) { + return n->__parent_and_flags & C_RBNODE_FLAG_MASK; +} + +static inline _Bool c_rbnode_is_red(CRBNode *n) { + return c_rbnode_flags(n) & C_RBNODE_RED; +} + +static inline _Bool c_rbnode_is_black(CRBNode *n) { + return !(c_rbnode_flags(n) & C_RBNODE_RED); +} + +static inline _Bool c_rbnode_is_root(CRBNode *n) { + return c_rbnode_flags(n) & C_RBNODE_ROOT; +} |