diff options
author | Christian Vogel <vogelchr@vogel.cx> | 2011-01-22 22:48:37 +0100 |
---|---|---|
committer | Christian Vogel <vogelchr@vogel.cx> | 2011-01-22 22:48:37 +0100 |
commit | c7f84e91b7a8142d445734dde46d26a3fecff6f3 (patch) | |
tree | 8086bc9ac4ad68694439d16de2652ba4aa15e15e /include | |
parent | aeb10770510decf85797c8768285641639be9026 (diff) |
ubit2pbit flushes at the wrong moment, added one note to bits.h
(e.g. input2[] test sequence from testra/crc_test
decodes incorrectly to packed bits: 90 b0 3e 80 03 87 53 bd 6f 08,
this patch fixes it)
Diffstat (limited to 'include')
-rw-r--r-- | include/osmocore/bits.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/osmocore/bits.h b/include/osmocore/bits.h index eb2cbcba..8d4a0789 100644 --- a/include/osmocore/bits.h +++ b/include/osmocore/bits.h @@ -7,6 +7,12 @@ typedef uint8_t sbit_t; /* soft bit (-127...127) */ typedef uint8_t ubit_t; /* unpacked bit (0 or 1) */ typedef uint8_t pbit_t; /* packed bis (8 bits in a byte) */ +/* + NOTE on the endianess of pbit_t: + Bits in a pbit_t are ordered MSB first, i.e. 0x80 is the first bit. + Bit i in a pbit_t array is array[i/8] & (1<<(7-i%8)) +*/ + /* determine how many bytes we would need for 'num_bits' packed bits */ static inline unsigned int osmo_pbit_bytesize(unsigned int num_bits) { |