MCPcopy Create free account
hub / github.com/GJDuck/e9patch / rotateLeft

Function rotateLeft

src/e9patch/e9alloc.cpp:125–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123#define RB_COLOR(N) (N)->color
124
125static void rotateLeft(Tree *t, Node *n)
126{
127 Node *tmp = RB_RIGHT(n);
128 if ((RB_RIGHT(n) = RB_LEFT(tmp)) != nullptr)
129 RB_PARENT(RB_LEFT(tmp)) = n;
130 fix(n);
131 if ((RB_PARENT(tmp) = RB_PARENT(n)) != nullptr)
132 {
133 if (n == RB_LEFT(RB_PARENT(n)))
134 RB_LEFT(RB_PARENT(n)) = tmp;
135 else
136 RB_RIGHT(RB_PARENT(n)) = tmp;
137 }
138 else
139 t->root = tmp;
140 RB_LEFT(tmp) = n;
141 RB_PARENT(n) = tmp;
142 fix(tmp);
143 if (RB_PARENT(tmp) != nullptr)
144 fix(RB_PARENT(tmp));
145}
146
147static void rotateRight(Tree *t, Node *n)
148{

Callers 2

rebalanceInsertFunction · 0.85
rebalanceRemoveFunction · 0.85

Calls 1

fixFunction · 0.70

Tested by

no test coverage detected