FastLED 3.10.6
Loading...
Searching...
No Matches

◆ flat_map_lower_bound_idx()

FL_NO_INLINE fl::size fl::detail::flat_map_lower_bound_idx ( const void * data,
fl::size n,
const void * key,
const flat_map_ops & ops )

Definition at line 13 of file flat_map_basic.cpp.hpp.

15 {
16 const char* base = static_cast<const char*>(data);
17 fl::size first_idx = 0;
18 fl::size count = n;
19 while (count > 0) {
20 fl::size step = count / 2;
21 fl::size mid_idx = first_idx + step;
22 // `.first` of `pair<Key, Value>` is at offset 0 (standard layout).
23 const void* mid_key = base + mid_idx * ops.element_size;
24 if (ops.less_fn(ops.less_ctx, mid_key, key)) {
25 first_idx = mid_idx + 1;
26 count -= step + 1;
27 } else {
28 count = step;
29 }
30 }
31 return first_idx;
32}
flat_map_less_thunk_t less_fn
constexpr enable_if< is_fixed_point< T >::value, T >::type step(T edge, T x) FL_NO_EXCEPT

References fl::FL_NO_EXCEPT, and fl::step().

Referenced by fl::flat_map< int, FxPtr >::lower_bound(), and fl::flat_map< int, FxPtr >::lower_bound().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: