5#include "force_inline.h"
10FASTLED_NAMESPACE_BEGIN
13#if defined(FASTLED_ARM) || defined(FASTLED_ESP8266) || defined(FASTLED_DOXYGEN)
81#define SWAPSA(X,N) out. X ## 0 = in.a.a ## N; \
82 out. X ## 1 = in.a.b ## N; \
83 out. X ## 2 = in.a.c ## N; \
84 out. X ## 3 = in.a.d ## N;
91#define SWAPSB(X,N) out. X ## 0 = in.b.a ## N; \
92 out. X ## 1 = in.b.b ## N; \
93 out. X ## 2 = in.b.c ## N; \
94 out. X ## 3 = in.b.d ## N;
101#define SWAPS(X,N) out. X ## 0 = in.a.a ## N; \
102 out. X ## 1 = in.a.b ## N; \
103 out. X ## 2 = in.a.c ## N; \
104 out. X ## 3 = in.a.d ## N; \
105 out. X ## 4 = in.b.a ## N; \
106 out. X ## 5 = in.b.b ## N; \
107 out. X ## 6 = in.b.c ## N; \
108 out. X ## 7 = in.b.d ## N;
143 for(
int i = 0; i < 8; ++i) {
145 work.
a3 = in.
word[0] >> 31;
146 work.
a2 = in.
word[0] >> 23;
147 work.
a1 = in.
word[0] >> 15;
148 work.
a0 = in.
word[0] >> 7;
150 work.
a7 = in.
word[1] >> 31;
151 work.
a6 = in.
word[1] >> 23;
152 work.
a5 = in.
word[1] >> 15;
153 work.
a4 = in.
word[1] >> 7;
160FASTLED_FORCE_INLINE
void slowswap(
unsigned char *A,
unsigned char *B) {
162 for(
int row = 0; row < 7; ++row) {
165 uint8_t bit = (1<<row);
166 unsigned char *p = B;
167 for(uint32_t mask = 1<<7 ; mask ; mask >>= 1) {
191FASTLED_FORCE_INLINE
void transpose8x1(
unsigned char *A,
unsigned char *B) {
195 y = *(
unsigned int*)(A);
196 x = *(
unsigned int*)(A+4);
199 t = (x ^ (x >> 7)) & 0x00AA00AA; x = x ^ t ^ (t << 7);
200 t = (x ^ (x >>14)) & 0x0000CCCC; x = x ^ t ^ (t <<14);
203 t = (y ^ (y >> 7)) & 0x00AA00AA; y = y ^ t ^ (t << 7);
204 t = (y ^ (y >>14)) & 0x0000CCCC; y = y ^ t ^ (t <<14);
207 t = (x & 0xF0F0F0F0) | ((y >> 4) & 0x0F0F0F0F);
208 y = ((x << 4) & 0xF0F0F0F0) | (y & 0x0F0F0F0F);
212 *((uint32_t*)(B+4)) = x;
221 y = *(
unsigned int*)(A);
222 x = *(
unsigned int*)(A+4);
225 t = (x ^ (x >> 7)) & 0x00AA00AA; x = x ^ t ^ (t << 7);
226 t = (x ^ (x >>14)) & 0x0000CCCC; x = x ^ t ^ (t <<14);
229 t = (y ^ (y >> 7)) & 0x00AA00AA; y = y ^ t ^ (t << 7);
230 t = (y ^ (y >>14)) & 0x0000CCCC; y = y ^ t ^ (t <<14);
233 t = (x & 0xF0F0F0F0) | ((y >> 4) & 0x0F0F0F0F);
234 y = ((x << 4) & 0xF0F0F0F0) | (y & 0x0F0F0F0F);
250template<
int m,
int n>
251FASTLED_FORCE_INLINE
void transpose8(
unsigned char *A,
unsigned char *B) {
256 y = *(
unsigned int*)(A);
257 x = *(
unsigned int*)(A+4);
259 x = (A[0]<<24) | (A[m]<<16) | (A[2*m]<<8) | A[3*m];
260 y = (A[4*m]<<24) | (A[5*m]<<16) | (A[6*m]<<8) | A[7*m];
264 t = (x ^ (x >> 7)) & 0x00AA00AA; x = x ^ t ^ (t << 7);
265 t = (x ^ (x >>14)) & 0x0000CCCC; x = x ^ t ^ (t <<14);
268 t = (y ^ (y >> 7)) & 0x00AA00AA; y = y ^ t ^ (t << 7);
269 t = (y ^ (y >>14)) & 0x0000CCCC; y = y ^ t ^ (t <<14);
272 t = (x & 0xF0F0F0F0) | ((y >> 4) & 0x0F0F0F0F);
273 y = ((x << 4) & 0xF0F0F0F0) | (y & 0x0F0F0F0F);
central include file for FastLED, defines the CFastLED class/object
FASTLED_FORCE_INLINE void swapbits8(bitswap_type in, bitswap_type &out)
Do an 8-byte by 8-bit rotation.
FASTLED_FORCE_INLINE void transpose8x1_MSB(unsigned char *A, unsigned char *B)
Simplified form of bits rotating function.
FASTLED_FORCE_INLINE void transpose8x1(unsigned char *A, unsigned char *B)
Simplified form of bits rotating function.
FASTLED_FORCE_INLINE void slowswap(unsigned char *A, unsigned char *B)
Slow version of the 8 byte by 8 bit rotation.
void transpose8x1_noinline(unsigned char *A, unsigned char *B)
Simplified form of bits rotating function.
FASTLED_FORCE_INLINE void transpose8(unsigned char *A, unsigned char *B)
Templated bit-rotating function.
Structure representing 32 bits of access.
uint32_t c3
byte 'c', bit 3 (0x00080000)
uint32_t d6
byte 'd', bit 6 (0x40000000)
uint32_t b6
byte 'b', bit 6 (0x00004000)
uint32_t c4
byte 'c', bit 4 (0x00100000)
uint32_t c6
byte 'c', bit 6 (0x00400000)
uint32_t a4
byte 'a', bit 4 (0x00000010)
uint32_t c1
byte 'c', bit 1 (0x00020000)
uint32_t d7
byte 'd', bit 7 (0x80000000)
uint32_t a3
byte 'a', bit 3 (0x00000008)
uint32_t a7
byte 'a', bit 7 (0x00000080)
uint32_t d5
byte 'd', bit 5 (0x20000000)
uint32_t a5
byte 'a', bit 5 (0x00000020)
uint32_t b0
byte 'b', bit 0 (0x00000100)
uint32_t c7
byte 'c', bit 7 (0x00800000)
uint32_t b3
byte 'b', bit 3 (0x00000800)
uint32_t d1
byte 'd', bit 1 (0x02000000)
uint32_t a1
byte 'a', bit 1 (0x00000002)
uint32_t b1
byte 'b', bit 1 (0x00000200)
uint32_t b5
byte 'b', bit 5 (0x00002000)
uint32_t d0
byte 'd', bit 0 (0x01000000)
uint32_t b7
byte 'b', bit 7 (0x00008000)
uint32_t b2
byte 'b', bit 2 (0x00000400)
uint32_t a2
byte 'a', bit 2 (0x00000004)
uint32_t a0
byte 'a', bit 0 (0x00000000)
uint32_t d2
byte 'd', bit 2 (0x04000000)
uint32_t c5
byte 'c', bit 5 (0x00200000)
uint32_t b4
byte 'b', bit 4 (0x00001000)
uint32_t d3
byte 'd', bit 3 (0x08000000)
uint32_t a6
byte 'a', bit 6 (0x00000040)
uint32_t c0
byte 'c', bit 0 (0x00010000)
uint32_t d4
byte 'd', bit 4 (0x10000000)
uint32_t c2
byte 'c', bit 2 (0x00040000)
Union containing a full 8 bytes to swap the bit orientation on.
sub4 b
32-bit access struct for bit swapping, lower four bytes (word[1] or bytes[4-7])
uint32_t word[2]
two 32-bit values to load for swapping
uint8_t bytes[8]
eight 8-bit values to load for swapping
sub4 a
32-bit access struct for bit swapping, upper four bytes (word[0] or bytes[0-3])
Structure representing 8 bits of access.
uint8_t raw
the entire byte