FastLED 3.7.8
Loading...
Searching...
No Matches
transpose8x1_noinline.cpp
1
2#include <stdint.h>
3
4void transpose8x1_noinline(unsigned char *A, unsigned char *B) {
5 uint32_t x, y, t;
6
7 // Load the array and pack it into x and y.
8 y = *(unsigned int*)(A);
9 x = *(unsigned int*)(A+4);
10
11 // pre-transform x
12 t = (x ^ (x >> 7)) & 0x00AA00AA; x = x ^ t ^ (t << 7);
13 t = (x ^ (x >>14)) & 0x0000CCCC; x = x ^ t ^ (t <<14);
14
15 // pre-transform y
16 t = (y ^ (y >> 7)) & 0x00AA00AA; y = y ^ t ^ (t << 7);
17 t = (y ^ (y >>14)) & 0x0000CCCC; y = y ^ t ^ (t <<14);
18
19 // final transform
20 t = (x & 0xF0F0F0F0) | ((y >> 4) & 0x0F0F0F0F);
21 y = ((x << 4) & 0xF0F0F0F0) | (y & 0x0F0F0F0F);
22 x = t;
23
24 *((uint32_t*)B) = y;
25 *((uint32_t*)(B+4)) = x;
26}
void transpose8x1_noinline(unsigned char *A, unsigned char *B)
Simplified form of bits rotating function.