| 928 | } |
| 929 | |
| 930 | void writeBit(unsigned char* output, int& pos, int& bit, int value, const int maxLength) { |
| 931 | if (pos >= maxLength) return; |
| 932 | |
| 933 | output[pos] <<= 1; |
| 934 | output[pos] |= value; |
| 935 | bit++; |
| 936 | if (bit >= 8) { |
| 937 | pos++; |
| 938 | bit = 0; |
| 939 | } |
| 940 | } |
| 941 | |
| 942 | void unpack(const unsigned char* data, unsigned char* output, const int maxLength) { |
| 943 | int pos = 0; |