FreeCalypso > hg > themwi-system-sw
comparison libutil/bitfunc.c @ 194:05d01e810217
libutil: add TFO message gen function based on Osmocom crc8gen
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Fri, 17 Mar 2023 16:52:21 -0800 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 193:1f9a6cede2c5 | 194:05d01e810217 |
|---|---|
| 1 /* | |
| 2 * Some bit manipulation functions. | |
| 3 */ | |
| 4 | |
| 5 #include <stdint.h> | |
| 6 #include "osmo_bits.h" | |
| 7 | |
| 8 void uint16_to_bits(uint16_t word, ubit_t *out, unsigned nbits) | |
| 9 { | |
| 10 unsigned n; | |
| 11 | |
| 12 for (n = 0; n < nbits; n++) | |
| 13 out[n] = (word >> (nbits-n-1)) & 1; | |
| 14 } |
