MCPcopy Create free account
hub / github.com/LUX-Core/lux / add_node

Method add_node

src/config/implementation.hpp:4591–4627  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4589 // Emplace/Insert
4590
4591 inline node_pointer add_node(
4592 node_pointer n, std::size_t key_hash, node_pointer pos)
4593 {
4594 n->hash_ = key_hash;
4595 if (pos) {
4596 node_algo::add_to_node_group(n, pos);
4597 if (n->next_) {
4598 std::size_t next_bucket =
4599 this->hash_to_bucket(node_algo::next_node(n)->hash_);
4600 if (next_bucket != this->hash_to_bucket(key_hash)) {
4601 this->get_bucket(next_bucket)->next_ = n;
4602 }
4603 }
4604 } else {
4605 bucket_pointer b = this->get_bucket(this->hash_to_bucket(key_hash));
4606
4607 if (!b->next_) {
4608 link_pointer start_node = this->get_previous_start();
4609
4610 if (start_node->next_) {
4611 this->get_bucket(
4612 this->hash_to_bucket(
4613 node_algo::next_node(start_node)->hash_))
4614 ->next_ = n;
4615 }
4616
4617 b->next_ = start_node;
4618 n->next_ = start_node->next_;
4619 start_node->next_ = n;
4620 } else {
4621 n->next_ = b->next_->next_;
4622 b->next_->next_ = n;
4623 }
4624 }
4625 ++this->size_;
4626 return n;
4627 }
4628
4629 inline node_pointer add_using_hint(node_pointer n, node_pointer hint)
4630 {

Callers 9

emplace_implMethod · 0.95
emplace_hint_implMethod · 0.95
move_insert_node_typeMethod · 0.95
copy_bucketsMethod · 0.95
move_bucketsMethod · 0.95
assign_bucketsMethod · 0.95
move_assign_bucketsMethod · 0.95

Calls 3

hash_to_bucketMethod · 0.80
get_bucketMethod · 0.80
get_previous_startMethod · 0.80

Tested by

no test coverage detected