FastLED 3.9.15
Loading...
Searching...
No Matches

◆ transpose8x1_noinline()

void transpose8x1_noinline ( unsigned char * A,
unsigned char * B )

Simplified form of bits rotating function.

This rotates data into LSB for a faster write (the code using this data can happily walk the array backwards).
Based on code found here: https://web.archive.org/web/20190108225554/http://www.hackersdelight.org/hdcodetxt/transpose8.c.txt

Definition at line 11 of file transpose8x1_noinline.cpp.

11 {
12 uint32_t x, y, t;
13
14 // Load the array and pack it into x and y.
15 y = *(unsigned int*)(A);
16 x = *(unsigned int*)(A+4);
17
18 // pre-transform x
19 t = (x ^ (x >> 7)) & 0x00AA00AA; x = x ^ t ^ (t << 7);
20 t = (x ^ (x >>14)) & 0x0000CCCC; x = x ^ t ^ (t <<14);
21
22 // pre-transform y
23 t = (y ^ (y >> 7)) & 0x00AA00AA; y = y ^ t ^ (t << 7);
24 t = (y ^ (y >>14)) & 0x0000CCCC; y = y ^ t ^ (t <<14);
25
26 // final transform
27 t = (x & 0xF0F0F0F0) | ((y >> 4) & 0x0F0F0F0F);
28 y = ((x << 4) & 0xF0F0F0F0) | (y & 0x0F0F0F0F);
29 x = t;
30
31 *((uint32_t*)B) = y;
32 *((uint32_t*)(B+4)) = x;
33}
uint32_t x[NUM_LAYERS]
Definition Fire2023.ino:80
uint32_t y[NUM_LAYERS]
Definition Fire2023.ino:81

References x, and y.