|
FastLED 3.10.6
|
| FL_FIXED_POINT_DIVIDE_INLINE u32 fl::divide64By32 | ( | u32 | hi, |
| u32 | lo, | ||
| u32 | divisor ) |
(hi:lo) / divisor, for a quotient that fits 32 bits.
Knuth's Algorithm D over two base-2^16 digits, which is what lets a 64-bit numerator be divided using the 32-bit divider twice. The two correction loops run at most twice each and usually not at all; they are what make the base-2^16 estimate exact rather than approximate.
Defined, not undefined, on the two inputs the wide path leaves to the compiler: a zero divisor and a quotient too large for 32 bits both return 0xFFFFFFFF. That is a deliberate difference and is not something a caller may rely on – the wide path wraps instead – so operator/'s contract is unchanged and the divergence is pinned by a test rather than left to be discovered.
Kept out of #if FL_FIXED_POINT_NARROW_DIVIDE on purpose. Gating the definition would leave it compiled by no host and tested by nothing, which is how simd_noop.hpp went two rounds of tuning against a build that excluded it (FastLED#4216).
Definition at line 120 of file wide_divide.h.
References fl::detail::fixedPointLeadingZeros(), FL_FIXED_POINT_DIVIDE_INLINE, and FL_NO_EXCEPT.
Referenced by fl::s16x16::operator/(), and fl::u16x16::operator/().
Here is the call graph for this function:
Here is the caller graph for this function: