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 112 of file bitswap.h.

112 {
113
114 // SWAPS(a.a,7);
115 // SWAPS(a.b,6);
116 // SWAPS(a.c,5);
117 // SWAPS(a.d,4);
118 // SWAPS(b.a,3);
119 // SWAPS(b.b,2);
120 // SWAPS(b.c,1);
121 // SWAPS(b.d,0);
122
123 // SWAPSA(a.a,7);
124 // SWAPSA(a.b,6);
125 // SWAPSA(a.c,5);
126 // SWAPSA(a.d,4);
127 //
128 // SWAPSB(a.a,7);
129 // SWAPSB(a.b,6);
130 // SWAPSB(a.c,5);
131 // SWAPSB(a.d,4);
132 //
133 // SWAPSA(b.a,3);
134 // SWAPSA(b.b,2);
135 // SWAPSA(b.c,1);
136 // SWAPSA(b.d,0);
137 // //
138 // SWAPSB(b.a,3);
139 // SWAPSB(b.b,2);
140 // SWAPSB(b.c,1);
141 // SWAPSB(b.d,0);
142
143 for(int i = 0; i < 8; ++i) {
144 just8bits work;
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;
149 in.word[0] <<= 1;
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;
154 in.word[1] <<= 1;
155 out.bytes[i] = work.raw;
156 }
157}
uint32_t word[2]
two 32-bit values to load for swapping
Definition bitswap.h:67
uint8_t bytes[8]
eight 8-bit values to load for swapping
Definition bitswap.h:68
uint8_t raw
the entire byte
Definition bitswap.h:16
Structure representing 8 bits of access.
Definition bitswap.h:15

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