You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello! I really love how tidy and efficient FAB LED is, but I found a missed optimization in the core loops, where it loops over the individual bits of each color byte.
For example, here, in onePortSoftwareSendBytes:
const uint8_t val = array[c];
for(int8_t b=7; b>=0; b--) {
const bool bit = (val>>b) & 0x1;
The problem is that AVR has no instruction to shift by more than 1 bit at a time, so val >> b compiles to an additional loop that executes for every bit to be sent.
The extra loop can be eliminated by changing to:
uint8_t val = array[c];
for(uint8_t b=0; b<8; b++, val <<= 1) {
const bool bit = val & 0x80;
The text was updated successfully, but these errors were encountered:
Hello! I really love how tidy and efficient FAB LED is, but I found a missed optimization in the core loops, where it loops over the individual bits of each color byte.
For example, here, in
onePortSoftwareSendBytes
:The problem is that AVR has no instruction to shift by more than 1 bit at a time, so
val >> b
compiles to an additional loop that executes for every bit to be sent.The extra loop can be eliminated by changing to:
The text was updated successfully, but these errors were encountered: