FastLED 3.10.8
Loading...
Searching...
No Matches

◆ find_slot()

template<typename Key, typename T, typename Hash = Hash<Key>, typename KeyEqual = EqualTo<Key>, int INLINED_COUNT = FASTLED_HASHMAP_INLINED_COUNT>
pair< fl::size, bool > fl::unordered_map< Key, T, Hash, KeyEqual, INLINED_COUNT >::find_slot ( const Key & key) const
inlineprivate

Definition at line 848 of file unordered_map.h.

848 {
849 const fl::size cap = _buckets.size();
850 const fl::size mask = cap - 1;
851 const fl::size h = _hash(key) & mask;
853
854 // Probe sequence comes from the shared (non-template) helper -- avoids
855 // duplicating the (cap <= 8 ? linear : quadratic-then-linear)
856 // branch logic across every unordered_map<K, V, Hash, Equal>
857 // instantiation. See FastLED #3235 Tier 1C.
858 for (fl::size i = 0; i < cap; ++i) {
860
861 if (is_empty(idx))
862 return {first_tomb != npos() ? first_tomb : idx, true};
863 if (is_deleted(idx)) {
864 if (first_tomb == npos())
865 first_tomb = idx;
866 } else if (is_occupied(idx) && _equal(_buckets[idx].key, key)) {
867 return {idx, false};
868 }
869 }
870
871 return {npos(), false};
872 }
bool is_occupied(fl::size idx) const FL_NO_EXCEPT
bool is_deleted(fl::size idx) const FL_NO_EXCEPT
static fl::size npos() FL_NO_EXCEPT
fl::vector_inlined< Entry, INLINED_COUNT > _buckets
bool is_empty(fl::size idx) const FL_NO_EXCEPT
FL_NO_INLINE fl::size unordered_map_probe_idx(fl::size h, fl::size i, fl::size mask, fl::size cap) FL_NO_EXCEPT