19 const unsigned char*
const cdata =
20 static_cast<const unsigned char*
>(data);
23 out.resize(size * 9 - 1);
25 std::string::iterator oi = out.begin();
26 for (
const unsigned char* si = cdata; si != cdata + size; ++si) {
27 *(oi + 0) =
'0' + ((*si >> 7) & 1);
28 *(oi + 1) =
'0' + ((*si >> 6) & 1);
29 *(oi + 2) =
'0' + ((*si >> 5) & 1);
30 *(oi + 3) =
'0' + ((*si >> 4) & 1);
31 *(oi + 4) =
'0' + ((*si >> 3) & 1);
32 *(oi + 5) =
'0' + ((*si >> 2) & 1);
33 *(oi + 6) =
'0' + ((*si >> 1) & 1);
34 *(oi + 7) =
'0' + ((*si >> 0) & 1);
36 if (si + 1 != cdata + size) {
52 const unsigned char*
const cdata =
53 static_cast<const unsigned char*
>(data);
56 out.resize(size * 9 - 1);
58 std::string::iterator oi = out.begin();
59 for (
const unsigned char* si = cdata; si != cdata + size; ++si) {
60 *(oi + 0) =
'0' + ((*si >> 0) & 1);
61 *(oi + 1) =
'0' + ((*si >> 1) & 1);
62 *(oi + 2) =
'0' + ((*si >> 2) & 1);
63 *(oi + 3) =
'0' + ((*si >> 3) & 1);
64 *(oi + 4) =
'0' + ((*si >> 4) & 1);
65 *(oi + 5) =
'0' + ((*si >> 5) & 1);
66 *(oi + 6) =
'0' + ((*si >> 6) & 1);
67 *(oi + 7) =
'0' + ((*si >> 7) & 1);
69 if (si + 1 != cdata + size) {
std::string bitdump_le8(const void *const data, size_t size)
Dump a (binary) string as a sequence of 8-bit little-endian bytes.
std::basic_string< char, std::char_traits< char >, Allocator< char > > string
string with Manager tracking
std::string bitdump_be8(const void *const data, size_t size)
Dump a (binary) string as a sequence of 8-bit big-endian bytes.