FastLED
3.9.15
Loading...
Searching...
No Matches
◆
find_unoccupied_index_using_bitset()
template<typename
Key
, typename T, typename
Hash
= Hash<Key>, typename KeyEqual = EqualTo<Key>, int INLINED_COUNT = FASTLED_HASHMAP_INLINED_COUNT>
fl::size
fl::unordered_map
<
Key
, T,
Hash
, KeyEqual, INLINED_COUNT >::find_unoccupied_index_using_bitset
(
const
Key
&
key
,
const fl::bitset< 1024 > &
occupied_set
) const
inline
private
Definition at line
944
of file
unordered_map.h
.
945
{
946
const
fl::size
cap
=
_buckets
.size();
947
const
fl::size
mask
=
cap
- 1;
948
const
fl::size
h
=
_hash
(
key
) &
mask
;
949
950
if
(
cap
<=
kLinearProbingOnlySize
) {
951
// linear probing
952
for
(
fl::size
i
= 0;
i
<
cap
; ++
i
) {
953
const
fl::size
idx
= (
h
+
i
) &
mask
;
954
bool
occupied
=
occupied_set
.test(
idx
);
955
if
(
occupied
) {
956
continue
;
957
}
958
return
idx
;
959
}
960
}
else
{
961
// quadratic probing up to 8 tries
962
fl::size
i
= 0;
963
for
(;
i
<
kQuadraticProbingTries
; ++
i
) {
964
const
fl::size
idx
= (
h
+
i
+
i
*
i
) &
mask
;
965
bool
occupied
=
occupied_set
.test(
idx
);
966
if
(
occupied
) {
967
continue
;
968
}
969
return
idx
;
970
}
971
// fallback to linear for the rest
972
for
(;
i
<
cap
; ++
i
) {
973
const
fl::size
idx
= (
h
+
i
) &
mask
;
974
bool
occupied
=
occupied_set
.test(
idx
);
975
if
(
occupied
) {
976
continue
;
977
}
978
return
idx
;
979
}
980
}
981
return
npos
();
982
}
fl::unordered_map::npos
static fl::size npos()
Definition
unordered_map.h:804
fl::unordered_map::_hash
Hash _hash
Definition
unordered_map.h:1123
fl::unordered_map::_buckets
fl::vector_inlined< Entry, INLINED_COUNT > _buckets
Definition
unordered_map.h:1117
fl::unordered_map::kLinearProbingOnlySize
@ kLinearProbingOnlySize
Definition
unordered_map.h:903
fl::unordered_map::kQuadraticProbingTries
@ kQuadraticProbingTries
Definition
unordered_map.h:904
fl::unordered_map
Definition
unordered_map.h:58
fl
unordered_map
Generated on Tue Jun 16 2026 00:07:07 for FastLED by
1.13.2