MCPcopy Create free account
hub / github.com/Tencent/Hardcoder / Resize

Method Resize

libapp2sys/prebuilt/include/google/protobuf/map.h:1154–1170  ·  view source on GitHub ↗

Resize to the given number of buckets.

Source from the content-addressed store, hash-verified

1152
1153 // Resize to the given number of buckets.
1154 void Resize(size_t new_num_buckets) {
1155 GOOGLE_DCHECK_GE(new_num_buckets, kMinTableSize);
1156 void** const old_table = table_;
1157 const size_type old_table_size = num_buckets_;
1158 num_buckets_ = new_num_buckets;
1159 table_ = CreateEmptyTable(num_buckets_);
1160 const size_type start = index_of_first_non_null_;
1161 index_of_first_non_null_ = num_buckets_;
1162 for (size_type i = start; i < old_table_size; i++) {
1163 if (TableEntryIsNonEmptyList(old_table, i)) {
1164 TransferList(old_table, i);
1165 } else if (TableEntryIsTree(old_table, i)) {
1166 TransferTree(old_table, i++);
1167 }
1168 }
1169 Dealloc<void*>(old_table, old_table_size);
1170 }
1171
1172 void TransferList(void* const* table, size_type index) {
1173 Node* node = static_cast<Node*>(table[index]);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected