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

Method add_node

src/config/implementation.hpp:3711–3736  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3709 // Emplace/Insert
3710
3711 inline node_pointer add_node(node_pointer n, std::size_t key_hash)
3712 {
3713 n->hash_ = key_hash;
3714
3715 bucket_pointer b = this->get_bucket(this->hash_to_bucket(key_hash));
3716
3717 if (!b->next_) {
3718 link_pointer start_node = this->get_previous_start();
3719
3720 if (start_node->next_) {
3721 this->get_bucket(this->hash_to_bucket(
3722 node_algo::next_node(start_node)->hash_))
3723 ->next_ = n;
3724 }
3725
3726 b->next_ = start_node;
3727 n->next_ = start_node->next_;
3728 start_node->next_ = n;
3729 } else {
3730 n->next_ = b->next_->next_;
3731 b->next_->next_ = n;
3732 }
3733
3734 ++this->size_;
3735 return n;
3736 }
3737
3738 inline node_pointer resize_and_add_node(
3739 node_pointer n, std::size_t key_hash)

Callers 9

resize_and_add_nodeMethod · 0.95
merge_implFunction · 0.45
insert_range_impl2Function · 0.45
insert_range_implFunction · 0.45
copy_bucketsFunction · 0.45
move_bucketsFunction · 0.45
assign_bucketsFunction · 0.45
move_assign_bucketsFunction · 0.45

Calls 3

get_bucketMethod · 0.80
hash_to_bucketMethod · 0.80
get_previous_startMethod · 0.80

Tested by

no test coverage detected