FastLED 3.9.15
|
LIB8STATIC uint16_t div1024_32_16 | ( | uint32_t | in32 | ) |
Helper routine to divide a 32-bit value by 1024, returning only the low 16 bits.
You'd think this would be just
And on ARM, that's what you want and all is well. But on AVR that code turns into a loop that executes a four-byte shift ten times: 40 shifts in all, plus loop overhead. This routine gets exactly the same result with just six shifts (vs 40), and no loop overhead. Used to convert millis to "binary seconds" aka bseconds: one bsecond == 1024 millis.
Definition at line 1040 of file lib8tion.h.
References LIB8STATIC.
Referenced by bseconds16().