J
John Deuf
Does somebody has a better algorithm than mine to reverse a byte
(i.e. bit 0 becomes 7, bit 1 becomes 6 ...)
unsigned char u=0, c = TESTVALUE;
int i;
for (i=0 ; i<4 ; i++) u |= ((c & (1 << i)) << (7-2*i))
| ((c & (1 << 7-i)) >> (7-2*i));
I need something quick. Thx.
(i.e. bit 0 becomes 7, bit 1 becomes 6 ...)
unsigned char u=0, c = TESTVALUE;
int i;
for (i=0 ; i<4 ; i++) u |= ((c & (1 << i)) << (7-2*i))
| ((c & (1 << 7-i)) >> (7-2*i));
I need something quick. Thx.