FreeCalypso > hg > gsm-codec-lib
changeset 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 | e7c8d739c4c8 |
children | 3b64f255689a |
files | miscutil/amr2efr.c miscutil/bitmanip.c miscutil/efr2amr.c |
diffstat | 3 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/miscutil/amr2efr.c Sun Nov 27 06:25:06 2022 +0000 +++ b/miscutil/amr2efr.c Sun Nov 27 21:02:07 2022 +0000 @@ -64,7 +64,6 @@ fprintf(stderr, "error: short read from %s\n", infname); exit(1); } - bzero(frm_out, 31); frm_out[0] = 0xC0; for (bit_a = 0; bit_a < 244; bit_a++) { if (wrong_flag)
--- a/miscutil/bitmanip.c Sun Nov 27 06:25:06 2022 +0000 +++ b/miscutil/bitmanip.c Sun Nov 27 21:02:07 2022 +0000 @@ -20,5 +20,8 @@ int pos_byte = bn >> 3; int pos_bit = 7 - (bn & 7); - buf[pos_byte] |= (bit << pos_bit); + if (bit) + buf[pos_byte] |= (1 << pos_bit); + else + buf[pos_byte] &= ~(1 << pos_bit); }