PlatformIO package of the Teensy core framework compatible with GCC 10 & C++20
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3 年之前
12345678910111213141516171819202122232425262728
  1. #define FASTLED_INTERNAL
  2. #include "FastLED.h"
  3. /// Simplified form of bits rotating function. Based on code found here - http://www.hackersdelight.org/hdcodetxt/transpose8.c.txt - rotating
  4. /// data into LSB for a faster write (the code using this data can happily walk the array backwards)
  5. void transpose8x1_noinline(unsigned char *A, unsigned char *B) {
  6. uint32_t x, y, t;
  7. // Load the array and pack it into x and y.
  8. y = *(unsigned int*)(A);
  9. x = *(unsigned int*)(A+4);
  10. // pre-transform x
  11. t = (x ^ (x >> 7)) & 0x00AA00AA; x = x ^ t ^ (t << 7);
  12. t = (x ^ (x >>14)) & 0x0000CCCC; x = x ^ t ^ (t <<14);
  13. // pre-transform y
  14. t = (y ^ (y >> 7)) & 0x00AA00AA; y = y ^ t ^ (t << 7);
  15. t = (y ^ (y >>14)) & 0x0000CCCC; y = y ^ t ^ (t <<14);
  16. // final transform
  17. t = (x & 0xF0F0F0F0) | ((y >> 4) & 0x0F0F0F0F);
  18. y = ((x << 4) & 0xF0F0F0F0) | (y & 0x0F0F0F0F);
  19. x = t;
  20. *((uint32_t*)B) = y;
  21. *((uint32_t*)(B+4)) = x;
  22. }