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