Lines Matching refs:__w
369 // __w is __x's possibly null uncle (will become __x's sibling)
370 _NodePtr __w = nullptr;
371 // link __x to __y's parent, and find __w
378 __w = __y->__parent_unsafe()->__right_;
380 __root = __x; // __w == nullptr
386 __w = __y->__parent_->__left_;
390 // but copy __z's color. This does not impact __x or __w.
429 // be null. __w can not be null here, else the parent would
431 // of 1 on the __w side (__w must be a non-null black or a red
435 if (!_VSTD::__tree_is_left_child(__w)) // if x is left child
437 if (!__w->__is_black_)
439 __w->__is_black_ = true;
440 __w->__parent_unsafe()->__is_black_ = false;
441 _VSTD::__tree_left_rotate(__w->__parent_unsafe());
444 if (__root == __w->__left_)
445 __root = __w;
447 __w = __w->__left_->__right_;
449 // __w->__is_black_ is now true, __w may have null children
450 if ((__w->__left_ == nullptr || __w->__left_->__is_black_) &&
451 (__w->__right_ == nullptr || __w->__right_->__is_black_))
453 __w->__is_black_ = false;
454 __x = __w->__parent_unsafe();
462 __w = _VSTD::__tree_is_left_child(__x) ?
467 else // __w has a red child
469 if (__w->__right_ == nullptr || __w->__right_->__is_black_)
471 // __w left child is non-null and red
472 __w->__left_->__is_black_ = true;
473 __w->__is_black_ = false;
474 _VSTD::__tree_right_rotate(__w);
475 // __w is known not to be root, so root hasn't changed
477 __w = __w->__parent_unsafe();
479 // __w has a right red child, left child may be null
480 __w->__is_black_ = __w->__parent_unsafe()->__is_black_;
481 __w->__parent_unsafe()->__is_black_ = true;
482 __w->__right_->__is_black_ = true;
483 _VSTD::__tree_left_rotate(__w->__parent_unsafe());
489 if (!__w->__is_black_)
491 __w->__is_black_ = true;
492 __w->__parent_unsafe()->__is_black_ = false;
493 _VSTD::__tree_right_rotate(__w->__parent_unsafe());
496 if (__root == __w->__right_)
497 __root = __w;
499 __w = __w->__right_->__left_;
501 // __w->__is_black_ is now true, __w may have null children
502 if ((__w->__left_ == nullptr || __w->__left_->__is_black_) &&
503 (__w->__right_ == nullptr || __w->__right_->__is_black_))
505 __w->__is_black_ = false;
506 __x = __w->__parent_unsafe();
514 __w = _VSTD::__tree_is_left_child(__x) ?
519 else // __w has a red child
521 if (__w->__left_ == nullptr || __w->__left_->__is_black_)
523 // __w right child is non-null and red
524 __w->__right_->__is_black_ = true;
525 __w->__is_black_ = false;
526 _VSTD::__tree_left_rotate(__w);
527 // __w is known not to be root, so root hasn't changed
529 __w = __w->__parent_unsafe();
531 // __w has a left red child, right child may be null
532 __w->__is_black_ = __w->__parent_unsafe()->__is_black_;
533 __w->__parent_unsafe()->__is_black_ = true;
534 __w->__left_->__is_black_ = true;
535 _VSTD::__tree_right_rotate(__w->__parent_unsafe());