FastLED 3.10.10
Loading...
Searching...
No Matches

◆ fixedPointLeadingZeros()

FL_FIXED_POINT_DIVIDE_INLINE int fl::detail::fixedPointLeadingZeros ( u32 value)

Leading zeros of a non-zero 32-bit value; 32 for zero.

Definition at line 86 of file wide_divide.h.

86 {
87#if defined(__GNUC__) || defined(__clang__)
88 // One CLZ instruction on every core this file's fast path is enabled for.
89 // __builtin_clz takes `unsigned int`, which is 16-bit on AVR; there the
90 // 32-bit `unsigned long` builtin is the one that sees every bit.
91 return value == 0 ? 32
92 : sizeof(unsigned) >= sizeof(u32)
93 ? __builtin_clz(static_cast<unsigned>(value))
94 : __builtin_clzl(static_cast<unsigned long>(value));
95#else
96 int count = 0;
97 while (count < 32 && (value & 0x80000000u) == 0u) {
98 value <<= 1;
99 ++count;
100 }
101 return count;
102#endif
103}
constexpr int type_rank< T >::value

References FL_FIXED_POINT_DIVIDE_INLINE, fl::FL_NO_EXCEPT, and fl::type_rank< T >::value.

Referenced by fl::divide64By32().

+ Here is the caller graph for this function: