I need to parse a binary message where the fields are bit packed. Basically I'm looking for a container that takes a sequence of bytes and then allows efficient access to multiple bits as unsigned values. Pseudo code:
std::bitvector<char> vec{std::bitvector::lsbfirst, {0xAB, 0xCD, 0xEF}};
auto value = vec.at(0, 5); // get the first 5 bits
Couldn't find anything like this in boost or the std containers (I looked at std::bitset, but that doesn't seem to fit the requirements).
Aucun commentaire:
Enregistrer un commentaire