MCPcopy Create free account
hub / github.com/FastLED/FastLED / rehash_internal

Function rehash_internal

src/fl/stl/unordered_map.h:984–1004  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

982 }
983
984 void rehash_internal(fl::size new_cap) {
985 new_cap = next_power_of_two(new_cap);
986 fl::vector_inlined<Entry, INLINED_COUNT> old(_buckets.get_resource());
987 fl::bitset<1024> old_occupied = _occupied;
988
989 _buckets.swap(old);
990 _buckets.clear();
991 _buckets.assign(new_cap, Entry{});
992
993 _occupied.reset();
994 _occupied.resize(new_cap);
995 _deleted.reset();
996 _deleted.resize(new_cap);
997
998 _size = _tombstones = 0;
999
1000 for (fl::size i = 0; i < old.size(); i++) {
1001 if (old_occupied.test(i))
1002 insert(fl::move(old[i].key), fl::move(old[i].value));
1003 }
1004 }
1005
1006 // Rehash the inline buckets without resizing
1007 FL_DISABLE_WARNING_PUSH

Callers 5

insertFunction · 0.85
insert_or_assignFunction · 0.85
try_emplaceFunction · 0.85
unordered_map.hFile · 0.85
rehashFunction · 0.85

Calls 9

next_power_of_twoFunction · 0.85
insertFunction · 0.70
swapMethod · 0.45
clearMethod · 0.45
assignMethod · 0.45
resetMethod · 0.45
resizeMethod · 0.45
sizeMethod · 0.45
testMethod · 0.45

Tested by

no test coverage detected