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

◆ swapbits8()

FASTLED_FORCE_INLINE void swapbits8 ( bitswap_type in,
bitswap_type & out )

Do an 8-byte by 8-bit rotation.

Definition at line 115 of file bitswap.h.

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

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