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

◆ flat_map_upper_bound_idx()

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

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

37 {
38 const char* base = static_cast<const char*>(data);
39 fl::size first_idx = 0;
40 fl::size count = n;
41 while (count > 0) {
42 fl::size step = count / 2;
43 fl::size mid_idx = first_idx + step;
44 const void* mid_key = base + mid_idx * ops.element_size;
45 // upper_bound: advance past elements where !(key < elem.first).
46 if (!ops.less_fn(ops.less_ctx, key, mid_key)) {
47 first_idx = mid_idx + 1;
48 count -= step + 1;
49 } else {
50 count = step;
51 }
52 }
53 return first_idx;
54}
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 >::upper_bound(), and fl::flat_map< int, FxPtr >::upper_bound().

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