src/ds/bst/rbt/lib.hpp
| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #pragma once | ||
| 2 | |||
| 3 | #include "../ost/lib.hpp" | ||
| 4 | |||
| 5 | namespace tifa_libs { | ||
| 6 | namespace rbt_impl_ { | ||
| 7 | using namespace ost_impl_; | ||
| 8 | struct rbt_op_leaf : bst_op_leaf { | ||
| 9 | template <tp2_ds_c pointer> | ||
| 10 |
6/6bool tifa_libs::rbt_impl_::rbt_op_leaf::is_red<tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*>(tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*):
✓ Branch 0 taken 423281 times.
✓ Branch 1 taken 58016 times.
bool tifa_libs::rbt_impl_::rbt_op_leaf::is_red<tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, std::pair<unsigned long, unsigned long> >*>(tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, std::pair<unsigned long, unsigned long> >*):
✓ Branch 0 taken 20141505 times.
✓ Branch 1 taken 2256839 times.
bool tifa_libs::rbt_impl_::rbt_op_leaf::is_red<tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*>(tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*):
✓ Branch 0 taken 39307599 times.
✓ Branch 1 taken 4924735 times.
|
67111975 | static CEXP bool is_red(pointer p) NE { retif_((p), p->red, false); } |
| 11 | template <tp2_ds_c pointer> | ||
| 12 | 14883892 | static CEXP void insert_leaf(pointer& root, pointer p, pointer n, bool dir) NE { | |
| 13 | 14883892 | n->red = p, bst_op_leaf::insert_leaf(root, p, n, dir); | |
| 14 |
6/6void tifa_libs::rbt_impl_::rbt_op_leaf::insert_leaf<tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*>(tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*&, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*, bool):
✓ Branch 1 taken 138696 times.
✓ Branch 2 taken 171942 times.
void tifa_libs::rbt_impl_::rbt_op_leaf::insert_leaf<tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, std::pair<unsigned long, unsigned long> >*>(tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, std::pair<unsigned long, unsigned long> >*&, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, std::pair<unsigned long, unsigned long> >*, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, std::pair<unsigned long, unsigned long> >*, bool):
✓ Branch 1 taken 8262254 times.
✓ Branch 2 taken 5873836 times.
void tifa_libs::rbt_impl_::rbt_op_leaf::insert_leaf<tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*>(tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*&, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*, bool):
✓ Branch 1 taken 16203640 times.
✓ Branch 2 taken 8838114 times.
|
39488482 | while (is_red(p = n->fa)) { |
| 15 | 24604590 | bool p_dir = p->child_dir(); | |
| 16 | 24604590 | auto g = p->fa, u = g->ch[!p_dir]; | |
| 17 |
6/6void tifa_libs::rbt_impl_::rbt_op_leaf::insert_leaf<tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*>(tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*&, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*, bool):
✓ Branch 1 taken 75345 times.
✓ Branch 2 taken 63351 times.
void tifa_libs::rbt_impl_::rbt_op_leaf::insert_leaf<tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, std::pair<unsigned long, unsigned long> >*>(tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, std::pair<unsigned long, unsigned long> >*&, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, std::pair<unsigned long, unsigned long> >*, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, std::pair<unsigned long, unsigned long> >*, bool):
✓ Branch 1 taken 4329680 times.
✓ Branch 2 taken 3932574 times.
void tifa_libs::rbt_impl_::rbt_op_leaf::insert_leaf<tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*>(tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*&, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*, bool):
✓ Branch 1 taken 8068356 times.
✓ Branch 2 taken 8135284 times.
|
24604590 | if (is_red(u)) { |
| 18 | 12473381 | p->red = u->red = false, g->red = true, n = g; | |
| 19 | 12473381 | continue; | |
| 20 | } | ||
| 21 |
6/6void tifa_libs::rbt_impl_::rbt_op_leaf::insert_leaf<tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*>(tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*&, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*, bool):
✓ Branch 1 taken 31705 times.
✓ Branch 2 taken 31646 times.
void tifa_libs::rbt_impl_::rbt_op_leaf::insert_leaf<tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, std::pair<unsigned long, unsigned long> >*>(tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, std::pair<unsigned long, unsigned long> >*&, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, std::pair<unsigned long, unsigned long> >*, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, std::pair<unsigned long, unsigned long> >*, bool):
✓ Branch 1 taken 616206 times.
✓ Branch 2 taken 3316368 times.
void tifa_libs::rbt_impl_::rbt_op_leaf::insert_leaf<tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*>(tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*&, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*, bool):
✓ Branch 1 taken 66643 times.
✓ Branch 2 taken 8068641 times.
|
12131209 | if (n->child_dir() != p_dir) rotate(root, p, p_dir), swap(n, p); |
| 22 | 12131209 | p->red = false, g->red = true, rotate(root, g, !p_dir); | |
| 23 | } | ||
| 24 | 14883892 | root->red = false; | |
| 25 | 14883892 | } | |
| 26 | template <tp2_ds_c pointer> | ||
| 27 | 772056 | static CEXP void erase_branch_leaf(pointer& root, pointer n) NE { | |
| 28 |
8/8void tifa_libs::rbt_impl_::rbt_op_leaf::erase_branch_leaf<tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*>(tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*&, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*):
✓ Branch 0 taken 34750 times.
✓ Branch 1 taken 2 times.
✓ Branch 3 taken 16131 times.
✓ Branch 4 taken 18619 times.
void tifa_libs::rbt_impl_::rbt_op_leaf::erase_branch_leaf<tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*>(tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*&, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*):
✓ Branch 0 taken 643583 times.
✓ Branch 1 taken 93721 times.
✓ Branch 3 taken 307910 times.
✓ Branch 4 taken 335673 times.
|
772056 | bool n_dir = n == root ? false : n->child_dir(); |
| 29 | 772056 | bst_op_leaf::erase_branch_leaf(root, n); | |
| 30 | 772056 | auto p = n->fa; | |
| 31 |
4/4void tifa_libs::rbt_impl_::rbt_op_leaf::erase_branch_leaf<tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*>(tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*&, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*):
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 34750 times.
void tifa_libs::rbt_impl_::rbt_op_leaf::erase_branch_leaf<tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*>(tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*&, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*):
✓ Branch 0 taken 93721 times.
✓ Branch 1 taken 643583 times.
|
772056 | if (!p) { |
| 32 |
3/4void tifa_libs::rbt_impl_::rbt_op_leaf::erase_branch_leaf<tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*>(tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*&, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*):
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
void tifa_libs::rbt_impl_::rbt_op_leaf::erase_branch_leaf<tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*>(tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*&, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*):
✓ Branch 0 taken 20785 times.
✓ Branch 1 taken 72936 times.
|
93723 | if (root) root->red = false; |
| 33 | 93723 | return; | |
| 34 |
4/4void tifa_libs::rbt_impl_::rbt_op_leaf::erase_branch_leaf<tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*>(tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*&, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*):
✓ Branch 0 taken 7702 times.
✓ Branch 1 taken 27048 times.
void tifa_libs::rbt_impl_::rbt_op_leaf::erase_branch_leaf<tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*>(tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*&, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*):
✓ Branch 0 taken 97628 times.
✓ Branch 1 taken 545955 times.
|
678333 | } else if (auto s = p->ch[n_dir]; s) return void(s->red = false); |
| 35 |
6/8void tifa_libs::rbt_impl_::rbt_op_leaf::erase_branch_leaf<tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*>(tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*&, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*):
✓ Branch 0 taken 29639 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9798 times.
✓ Branch 3 taken 19841 times.
void tifa_libs::rbt_impl_::rbt_op_leaf::erase_branch_leaf<tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*>(tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*&, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*):
✓ Branch 0 taken 1472881 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 987274 times.
✓ Branch 3 taken 485607 times.
|
1502520 | while (p && !n->red) { |
| 36 | 997072 | auto s = p->ch[!n_dir]; | |
| 37 |
4/4void tifa_libs::rbt_impl_::rbt_op_leaf::erase_branch_leaf<tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*>(tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*&, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*):
✓ Branch 1 taken 1314 times.
✓ Branch 2 taken 8484 times.
void tifa_libs::rbt_impl_::rbt_op_leaf::erase_branch_leaf<tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*>(tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*&, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*):
✓ Branch 1 taken 18440 times.
✓ Branch 2 taken 968834 times.
|
997072 | if (is_red(s)) { |
| 38 | 19754 | s->red = false, p->red = true; | |
| 39 | 19754 | rotate(root, p, n_dir), s = p->ch[!n_dir]; | |
| 40 | } | ||
| 41 | 997072 | auto c = s->ch[n_dir], d = s->ch[!n_dir]; | |
| 42 |
12/12void tifa_libs::rbt_impl_::rbt_op_leaf::erase_branch_leaf<tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*>(tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*&, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*):
✓ Branch 1 taken 5160 times.
✓ Branch 2 taken 4638 times.
✓ Branch 4 taken 2591 times.
✓ Branch 5 taken 2569 times.
✓ Branch 6 taken 2591 times.
✓ Branch 7 taken 7207 times.
void tifa_libs::rbt_impl_::rbt_op_leaf::erase_branch_leaf<tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*>(tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*&, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*):
✓ Branch 1 taken 952347 times.
✓ Branch 2 taken 34927 times.
✓ Branch 4 taken 927229 times.
✓ Branch 5 taken 25118 times.
✓ Branch 6 taken 927229 times.
✓ Branch 7 taken 60045 times.
|
997072 | if (!is_red(c) && !is_red(d)) { |
| 43 |
3/4void tifa_libs::rbt_impl_::rbt_op_leaf::erase_branch_leaf<tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*>(tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*&, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*):
✗ Branch 0 not taken.
✓ Branch 1 taken 2591 times.
void tifa_libs::rbt_impl_::rbt_op_leaf::erase_branch_leaf<tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*>(tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*&, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*):
✓ Branch 0 taken 303 times.
✓ Branch 1 taken 926926 times.
|
929820 | if (s->red = true, n = p, p = n->fa; !p) break; |
| 44 | 929517 | n_dir = n->child_dir(); | |
| 45 | 929517 | continue; | |
| 46 | } | ||
| 47 |
4/4void tifa_libs::rbt_impl_::rbt_op_leaf::erase_branch_leaf<tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*>(tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*&, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, int>*):
✓ Branch 1 taken 2550 times.
✓ Branch 2 taken 4657 times.
void tifa_libs::rbt_impl_::rbt_op_leaf::erase_branch_leaf<tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*>(tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*&, tifa_libs::ostnode_impl_::ostree_node_t<tifa_libs::ost_impl_::bst_op<tifa_libs::rbt_impl_::rbt_op_leaf>, unsigned int>*):
✓ Branch 1 taken 27925 times.
✓ Branch 2 taken 32120 times.
|
67252 | if (!is_red(d)) { |
| 48 | 30475 | c->red = false, s->red = true; | |
| 49 | 30475 | rotate(root, s, !n_dir); | |
| 50 | 30475 | s = p->ch[!n_dir], c = s->ch[n_dir], d = s->ch[!n_dir]; | |
| 51 | } | ||
| 52 | 67252 | s->red = p->red, p->red = d->red = false, rotate(root, p, n_dir), n = root; | |
| 53 | 67252 | break; | |
| 54 | } | ||
| 55 | 573003 | n->red = false; | |
| 56 | } | ||
| 57 | }; | ||
| 58 | using rbt_tag = bst_op<rbt_op_leaf>; | ||
| 59 | |||
| 60 | } // namespace rbt_impl_ | ||
| 61 | namespace ostnode_impl_ { | ||
| 62 | template <class K> | ||
| 63 | struct ostree_node_t<rbt_impl_::rbt_tag, K> { | ||
| 64 | // NOLINTNEXTLINE(modernize-avoid-c-arrays) | ||
| 65 | ostree_node_t *fa, *ch[2]; | ||
| 66 | K data; | ||
| 67 | u32 sz; | ||
| 68 | bool red; | ||
| 69 | // @return child direction of this non-root point | ||
| 70 | 44710283 | ND CEXP bool child_dir() CNE { return this == fa->ch[1]; } | |
| 71 | }; | ||
| 72 | } // namespace ostnode_impl_ | ||
| 73 | |||
| 74 | template <class K, class Comp = std::less<K>> | ||
| 75 | using rbtree = ost_impl_::ostree<K, rbt_impl_::rbt_tag, Comp>; | ||
| 76 | |||
| 77 | } // namespace tifa_libs | ||
| 78 |