| 10 | |
| 11 | |
| 12 | std::vector<unsigned char> BitsToBytes(const std::vector<bool>& bits) |
| 13 | { |
| 14 | std::vector<unsigned char> ret((bits.size() + 7) / 8); |
| 15 | for (unsigned int p = 0; p < bits.size(); p++) { |
| 16 | ret[p / 8] |= bits[p] << (p % 8); |
| 17 | } |
| 18 | return ret; |
| 19 | } |
| 20 | |
| 21 | std::vector<bool> BytesToBits(const std::vector<unsigned char>& bytes) |
| 22 | { |