comparison miscutil/bitmanip.c @ 101:d86f866489e9

gsm-amr2efr utility written
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 27 Nov 2022 05:15:39 +0000
parents frtest/tidsp.c@7960744ba19c
children 41f1ae68d253
comparison
equal deleted inserted replaced
100:d5bab777865a 101:d86f866489e9
1 /*
2 * This module provides two utility functions that serve as building blocks
3 * for frame bit reordering operations.
4 */
5
6 #include <stdint.h>
7
8 msb_get_bit(buf, bn)
9 uint8_t *buf;
10 {
11 int pos_byte = bn >> 3;
12 int pos_bit = 7 - (bn & 7);
13
14 return (buf[pos_byte] >> pos_bit) & 1;
15 }
16
17 msb_set_bit(buf, bn, bit)
18 uint8_t *buf;
19 {
20 int pos_byte = bn >> 3;
21 int pos_bit = 7 - (bn & 7);
22
23 buf[pos_byte] |= (bit << pos_bit);
24 }