comparison miscutil/bitmanip.c @ 107:41f1ae68d253

amr2efr & efr2amr cosmetic: cleaner approach to bit reshuffling
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 27 Nov 2022 21:02:07 +0000
parents d86f866489e9
children
comparison
equal deleted inserted replaced
106:e7c8d739c4c8 107:41f1ae68d253
18 uint8_t *buf; 18 uint8_t *buf;
19 { 19 {
20 int pos_byte = bn >> 3; 20 int pos_byte = bn >> 3;
21 int pos_bit = 7 - (bn & 7); 21 int pos_bit = 7 - (bn & 7);
22 22
23 buf[pos_byte] |= (bit << pos_bit); 23 if (bit)
24 buf[pos_byte] |= (1 << pos_bit);
25 else
26 buf[pos_byte] &= ~(1 << pos_bit);
24 } 27 }