| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
Add function which adds specified number of bits from each element of
array to the bit vector prefixing each addition with one and finishing
entire sequence with adding 0. This is very common patter for various
repetitive data structures described with CSN.1 in 3GPP standards.
Corresponding test vectors and doxygen headers are added too.
|
|
|
|
|
|
| |
It's sometimes handy for debugging to be able to immediately see which
bits are set in a given byte. Generalize macro used for that in bitvec
tests and make it available for the rest of the library.
|
|
|
|
|
| |
Add bit filling, shifting and other functions necessary for bit
compression implementation. Add corresponding tests.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
osmo_hexdump_nospc/osmo_hexdump is an old school C routine with a
static internal array. This means that printf will most likely one
of the two strings twice. For Linux/glibc this is the first string
(for whatever reason?) and for FreeBSD it is the last call of the
osmo_hexdump_nospc. We could have noticed by both strings being
of the same length besides the different length input. The second
issue is that we cast a hexstring to uint8_t and dump the string
as hex. So the two strings should not match at all.
Fix it by printing the hex string as plain hex and separating the
two printf calls. Update the test output.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
bitvec_read_field/bitvec_write_field in the PCU used a C++ reference
and when porting to C it was decided to pass the parameter by value
and this lost the "back propagation" of the new index. Change the
parameter to be an in/out parameter and this way do not have a silent
semantic break in the osmo-pcu (where we copy the reference in csn.1
by value) and have a true compile failure.
Add Max's simple test for bitvec_unhex function leaving the checking
of bitvec_read_field and the side effect in the datastructure about
the number of bits still open.
|
|
The new functions bitvec_get_bytes and bitvec_set_bytes copy
byte sequences from bitvecs to uint8_t arrays and vice versa.
While the bytes in the bitvecs do not need to be aligned, the uint8_t
arrays always are. In case the bytes in the bitvec are aligned, the
implementation uses memcpy.
Note that the implementation like the other existing functions assume
MSB first encoding.
[hfreyther: Squash the comment fix into this commit as well]
Sponsored-by: On-Waves ehf
|