FastLED 3.10.6
Loading...
Searching...
No Matches
deque_basic.cpp.hpp
Go to the documentation of this file.
1// IWYU pragma: private, include "fl/stl/deque_basic.h"
2//
3// deque_basic: implementation of the shared chunk-map grow-policy helper
4// used by every `fl::deque<T>` instantiation. See `deque_basic.h` for
5// design rationale (FastLED #3270).
6
8
9namespace fl {
10namespace detail {
11
13fl::size deque_grow_map_capacity(fl::size current_map_capacity,
14 fl::size min_required_chunks) FL_NO_EXCEPT {
15 fl::size next = current_map_capacity == 0
16 ? static_cast<fl::size>(kDequeInitialMapCapacity)
17 : current_map_capacity * 2;
18 while (next < min_required_chunks) {
19 if (next > static_cast<fl::size>(-1) / 2) {
20 // Saturate: doubling further would overflow fl::size.
21 return min_required_chunks;
22 }
23 next *= 2;
24 }
25 return next;
26}
27
28} // namespace detail
29} // namespace fl
#define FL_NO_INLINE
@ kDequeInitialMapCapacity
Definition deque_basic.h:29
FL_NO_INLINE fl::size deque_grow_map_capacity(fl::size current_map_capacity, fl::size min_required_chunks) FL_NO_EXCEPT
Compile-time linker keep-alive hook for a single fl::Bus.
Definition bus_info.h:57
InputGamut g FL_NO_EXCEPT
Definition rgbw.h:121
Base definition for an LED controller.
Definition crgb.hpp:179