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

◆ transpose8x1_MSB()

FASTLED_FORCE_INLINE void fl::transpose8x1_MSB ( unsigned char * A,
unsigned char * B )

Simplified 8x1 bit transpose with MSB-first output.

Based on: https://web.archive.org/web/20190108225554/http://www.hackersdelight.org/hdcodetxt/transpose8.c.txt

Parameters
AInput array (8 bytes)
BOutput array (8 bytes, transposed MSB-first)
Examples
/home/runner/work/FastLED/FastLED/src/fl/math/transposition.h.

Definition at line 146 of file transposition.h.

146 {
147 fl::u32 x, y, t;
148
149 // Load the array and pack it into x and y.
150 y = *(fl::u32*)(A);
151 x = *(fl::u32*)(A+4);
152
153 // pre-transform x
154 t = (x ^ (x >> 7)) & 0x00AA00AA; x = x ^ t ^ (t << 7);
155 t = (x ^ (x >>14)) & 0x0000CCCC; x = x ^ t ^ (t <<14);
156
157 // pre-transform y
158 t = (y ^ (y >> 7)) & 0x00AA00AA; y = y ^ t ^ (t << 7);
159 t = (y ^ (y >>14)) & 0x0000CCCC; y = y ^ t ^ (t <<14);
160
161 // final transform
162 t = (x & 0xF0F0F0F0) | ((y >> 4) & 0x0F0F0F0F);
163 y = ((x << 4) & 0xF0F0F0F0) | (y & 0x0F0F0F0F);
164 x = t;
165
166 B[7] = y; y >>= 8;
167 B[6] = y; y >>= 8;
168 B[5] = y; y >>= 8;
169 B[4] = y;
170
171 B[3] = x; x >>= 8;
172 B[2] = x; x >>= 8;
173 B[1] = x; x >>= 8;
174 B[0] = x;
175}
FL_DISABLE_WARNING_PUSH unsigned char * B

References B, FASTLED_FORCE_INLINE, FL_NOEXCEPT, t, x, and y.

Referenced by transpose_8strips().

+ Here is the caller graph for this function: