You can do something similar to avoid creating lines and some copying:
for (uint32_t i = 0; i < bs.size(); i+=8) { uint32_t uval = 0; for (uint32_t j = 0; j < 8; j++) { uval = (uval << 1) + bs[i + 7 - j]; } std::cout << uval << std::endl; }
but you may have to work with indexes depending on your entity
source share