FastLED 3.9.15
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages

◆ swapbits8()

FASTLED_FORCE_INLINE void swapbits8 ( bitswap_type in,
bitswap_type & out )

Do an 8-byte by 8-bit rotation.

Definition at line 114 of file bitswap.h.

114 {
115
116 // SWAPS(a.a,7);
117 // SWAPS(a.b,6);
118 // SWAPS(a.c,5);
119 // SWAPS(a.d,4);
120 // SWAPS(b.a,3);
121 // SWAPS(b.b,2);
122 // SWAPS(b.c,1);
123 // SWAPS(b.d,0);
124
125 // SWAPSA(a.a,7);
126 // SWAPSA(a.b,6);
127 // SWAPSA(a.c,5);
128 // SWAPSA(a.d,4);
129 //
130 // SWAPSB(a.a,7);
131 // SWAPSB(a.b,6);
132 // SWAPSB(a.c,5);
133 // SWAPSB(a.d,4);
134 //
135 // SWAPSA(b.a,3);
136 // SWAPSA(b.b,2);
137 // SWAPSA(b.c,1);
138 // SWAPSA(b.d,0);
139 // //
140 // SWAPSB(b.a,3);
141 // SWAPSB(b.b,2);
142 // SWAPSB(b.c,1);
143 // SWAPSB(b.d,0);
144
145 for(int i = 0; i < 8; ++i) {
146 just8bits work;
147 work.a3 = in.word[0] >> 31;
148 work.a2 = in.word[0] >> 23;
149 work.a1 = in.word[0] >> 15;
150 work.a0 = in.word[0] >> 7;
151 in.word[0] <<= 1;
152 work.a7 = in.word[1] >> 31;
153 work.a6 = in.word[1] >> 23;
154 work.a5 = in.word[1] >> 15;
155 work.a4 = in.word[1] >> 7;
156 in.word[1] <<= 1;
157 out.bytes[i] = work.raw;
158 }
159}
uint32_t word[2]
two 32-bit values to load for swapping
Definition bitswap.h:69
uint8_t bytes[8]
eight 8-bit values to load for swapping
Definition bitswap.h:70
uint8_t raw
the entire byte
Definition bitswap.h:18
Structure representing 8 bits of access.
Definition bitswap.h:17

References bitswap_type::bytes, FASTLED_FORCE_INLINE, just8bits::raw, and bitswap_type::word.