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

Function tree_rotate_left

examples/stdlib.c:5160–5176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5158#define TREE_COLOR(N) ((N)->color)
5159
5160static void tree_rotate_left(struct tree_s *t, struct node_s *n)
5161{
5162 struct node_s *tmp = TREE_RIGHT(n);
5163 if ((TREE_RIGHT(n) = TREE_LEFT(tmp)) != NULL)
5164 TREE_PARENT(TREE_LEFT(tmp)) = n;
5165 if ((TREE_PARENT(tmp) = TREE_PARENT(n)) != NULL)
5166 {
5167 if (n == TREE_LEFT(TREE_PARENT(n)))
5168 TREE_LEFT(TREE_PARENT(n)) = tmp;
5169 else
5170 TREE_RIGHT(TREE_PARENT(n)) = tmp;
5171 }
5172 else
5173 t->root = tmp;
5174 TREE_LEFT(tmp) = n;
5175 TREE_PARENT(n) = tmp;
5176}
5177
5178static void tree_rotate_right(struct tree_s *t, struct node_s *n)
5179{

Callers 2

tree_rebalance_insertFunction · 0.85
tree_rebalance_removeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected