|
|
|
@ -31,16 +31,15 @@
|
|
|
|
|
|
|
|
|
|
#include "liblte/phy/utils/bit.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void bit_pack_vector(uint8_t *bit_unpacked, uint8_t *bits_packed, int nof_bits)
|
|
|
|
|
void bit_pack_vector(uint8_t *bits_unpacked, uint8_t *bits_packed, int nof_bits)
|
|
|
|
|
{
|
|
|
|
|
uint32_t i, nbytes;
|
|
|
|
|
nbytes = nof_bits/8;
|
|
|
|
|
for (i=0;i<nbytes;i++) {
|
|
|
|
|
bit_pack(bits_packed[i], &bits_packed, 8);
|
|
|
|
|
bit_pack(bits_unpacked[i], &bits_packed, 8);
|
|
|
|
|
}
|
|
|
|
|
if (nof_bits%8) {
|
|
|
|
|
bit_pack(bits_packed[i], &bits_packed, nof_bits%8);
|
|
|
|
|
bit_pack(bits_unpacked[i], &bits_packed, nof_bits%8);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -54,15 +53,15 @@ void bit_pack(uint32_t value, uint8_t **bits, int nof_bits)
|
|
|
|
|
*bits += nof_bits;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void bit_unpack_vector(uint8_t *bits_packed, uint8_t *bit_unpacked, int nof_bits)
|
|
|
|
|
void bit_unpack_vector(uint8_t *bits_packed, uint8_t *bits_unpacked, int nof_bits)
|
|
|
|
|
{
|
|
|
|
|
uint32_t i, nbytes;
|
|
|
|
|
nbytes = nof_bits/8;
|
|
|
|
|
for (i=0;i<nbytes;i++) {
|
|
|
|
|
bits_packed[i] = bit_unpack(&bit_unpacked, 8);
|
|
|
|
|
bits_unpacked[i] = bit_unpack(&bits_packed, 8);
|
|
|
|
|
}
|
|
|
|
|
if (nof_bits%8) {
|
|
|
|
|
bits_packed[i] = bit_unpack(&bit_unpacked, nof_bits%8);
|
|
|
|
|
bits_unpacked[i] = bit_unpack(&bits_packed, nof_bits%8);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|