# HG changeset patch # User Mychaela Falconia # Date 1669582927 0 # Node ID 41f1ae68d2539516740e16200703fdaeb39ff9aa # Parent e7c8d739c4c8b189d298de94f7802a8603bfbbf5 amr2efr & efr2amr cosmetic: cleaner approach to bit reshuffling diff -r e7c8d739c4c8 -r 41f1ae68d253 miscutil/amr2efr.c --- 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) diff -r e7c8d739c4c8 -r 41f1ae68d253 miscutil/bitmanip.c --- 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); } diff -r e7c8d739c4c8 -r 41f1ae68d253 miscutil/efr2amr.c --- a/miscutil/efr2amr.c Sun Nov 27 06:25:06 2022 +0000 +++ b/miscutil/efr2amr.c Sun Nov 27 21:02:07 2022 +0000 @@ -74,7 +74,7 @@ outlen = 1; } else { frm_out[0] = 0x3C; - bzero(frm_out + 1, 31); + frm_out[31] = 0; for (bit_a = 0; bit_a < 244; bit_a++) { if (wrong_flag) bit_n = bit_a;