__rb_rotate_left(parent, root);
other = parent->rb_right;
}
- if ((!other->rb_left || rb_is_black(other->rb_left)) &&
- (!other->rb_right || rb_is_black(other->rb_right)))
- {
- rb_set_red(other);
- node = parent;
- parent = rb_parent(node);
- }
- else
- {
- if (!other->rb_right || rb_is_black(other->rb_right))
- {
- rb_set_black(other->rb_left);
+ if (!other->rb_right || rb_is_black(other->rb_right)) {
+ if (!other->rb_left ||
+ rb_is_black(other->rb_left)) {
rb_set_red(other);
- __rb_rotate_right(other, root);
- other = parent->rb_right;
+ node = parent;
+ parent = rb_parent(node);
+ continue;
}
- rb_set_color(other, rb_color(parent));
- rb_set_black(parent);
- rb_set_black(other->rb_right);
- __rb_rotate_left(parent, root);
- break;
+ rb_set_black(other->rb_left);
+ rb_set_red(other);
+ __rb_rotate_right(other, root);
+ other = parent->rb_right;
}
+ rb_set_color(other, rb_color(parent));
+ rb_set_black(parent);
+ rb_set_black(other->rb_right);
+ __rb_rotate_left(parent, root);
+ break;
} else {
other = parent->rb_left;
if (rb_is_red(other))
__rb_rotate_right(parent, root);
other = parent->rb_left;
}
- if ((!other->rb_left || rb_is_black(other->rb_left)) &&
- (!other->rb_right || rb_is_black(other->rb_right)))
- {
- rb_set_red(other);
- node = parent;
- parent = rb_parent(node);
- }
- else
- {
- if (!other->rb_left || rb_is_black(other->rb_left))
- {
- rb_set_black(other->rb_right);
+ if (!other->rb_left || rb_is_black(other->rb_left)) {
+ if (!other->rb_right ||
+ rb_is_black(other->rb_right)) {
rb_set_red(other);
- __rb_rotate_left(other, root);
- other = parent->rb_left;
+ node = parent;
+ parent = rb_parent(node);
+ continue;
}
- rb_set_color(other, rb_color(parent));
- rb_set_black(parent);
- rb_set_black(other->rb_left);
- __rb_rotate_right(parent, root);
- break;
+ rb_set_black(other->rb_right);
+ rb_set_red(other);
+ __rb_rotate_left(other, root);
+ other = parent->rb_left;
}
+ rb_set_color(other, rb_color(parent));
+ rb_set_black(parent);
+ rb_set_black(other->rb_left);
+ __rb_rotate_right(parent, root);
+ break;
}
}
}