1#ifndef CASACORE_TABLES_BITPACKING_H_
2#define CASACORE_TABLES_BITPACKING_H_
6inline void PackBoolArray(
unsigned char* packed_buffer,
const bool* input,
8 const size_t limit = n / 8;
9 const bool* end = input + n;
10 for (
size_t i = 0; i != limit; ++i) {
12 for (
size_t b = 0; b != 8; ++b) {
13 *packed_buffer |= (*input) << b;
22 *packed_buffer |= (*input) << b;
25 }
while (input != end);
31 bool* end = output + n;
32 const size_t limit = n / 8;
33 for (
size_t i = 0; i != limit; i++) {
34 for (
size_t b = 0; b != 8; ++b) {
35 *output = (*packed_input >> b) & 0x1;
41 while (output != end) {
42 *output = (*packed_input >> b) & 0x1;
void UnpackBoolArray(bool *output, const unsigned char *packed_input, size_t n)
void PackBoolArray(unsigned char *packed_buffer, const bool *input, size_t n)