25 #define RED ((uintptr_t)0x1u) 26 #define BLACK ((uintptr_t)0x0u) 27 #define COLOR(node) ((node)->parent & RED) 28 #define IS_RED(node) ( (node) != NULL && COLOR(node) ) 29 #define IS_BLACK(node) ( (node) == NULL || !COLOR(node) ) 30 #define MAKE_RED(node) do { (node)->parent |= RED; } while(0) 31 #define MAKE_BLACK(node) do { (node)->parent &= ~RED; } while(0) 34 #define OPPOSITE(dir) ( 1 - (dir) ) 35 #define PARENT(node) ( (SCIP_RBTREENODE*)((node)->parent & ~RED) ) 36 #define SET_PARENT(n, p) do { (n)->parent = (uintptr_t)(p) | COLOR(n); } while(0) 37 #define SET_COLOR(n, c) do { if( c == RED ) { MAKE_RED(n); } else { MAKE_BLACK(n); } } while(0) 52 if( y->
child[dir] != NULL )
62 else if( x == p->
child[dir] )
100 if( z == p->
child[dir] )
133 p =
PARENT(x == NULL ? nil : x);
144 assert(p ==
PARENT(x == NULL ? nil : x));
161 assert(p ==
PARENT(x == NULL ? nil : x));
263 while( y != NULL && x == y->
child[
LEFT] )
283 unsigned int yorigcolor;
288 yorigcolor =
COLOR(y);
303 yorigcolor =
COLOR(y);
321 if( yorigcolor ==
BLACK )
SCIP_RBTREENODE * SCIPrbtreeSuccessor_call(SCIP_RBTREENODE *x)
void SCIPrbtreeDelete_call(SCIP_RBTREENODE **root, SCIP_RBTREENODE *node)
static void rbDeleteFixup(SCIP_RBTREENODE **root, SCIP_RBTREENODE *x, SCIP_RBTREENODE *nil)
SCIP_RBTREENODE * SCIPrbtreeLast_call(SCIP_RBTREENODE *root)
SCIP_RBTREENODE * child[2]
SCIP_RBTREENODE * SCIPrbtreeFirst_call(SCIP_RBTREENODE *root)
#define SCIPrbtreeFirst(root)
SCIP_RBTREENODE * SCIPrbtreePredecessor_call(SCIP_RBTREENODE *x)
static void rbRotate(SCIP_RBTREENODE **root, SCIP_RBTREENODE *x, int dir)
void SCIPrbtreeInsert_call(SCIP_RBTREENODE **root, SCIP_RBTREENODE *parent, int pos, SCIP_RBTREENODE *node)
static void rbTransplant(SCIP_RBTREENODE **root, SCIP_RBTREENODE *u, SCIP_RBTREENODE *v, SCIP_RBTREENODE *nil)
intrusive red black tree datastructure
static void rbInsertFixup(SCIP_RBTREENODE **root, SCIP_RBTREENODE *z)