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) {
48 std::string
bitdump_le8(
const void*
const data,
size_t size) {
60 const unsigned char*
const cdata =
61 static_cast<const unsigned char*
>(data);
64 out.resize(size * 9 - 1);
66 std::string::iterator oi = out.begin();
67 for (
const unsigned char* si = cdata; si != cdata + size; ++si) {
68 *(oi + 0) =
'0' + ((*si >> 0) & 1);
69 *(oi + 1) =
'0' + ((*si >> 1) & 1);
70 *(oi + 2) =
'0' + ((*si >> 2) & 1);
71 *(oi + 3) =
'0' + ((*si >> 3) & 1);
72 *(oi + 4) =
'0' + ((*si >> 4) & 1);
73 *(oi + 5) =
'0' + ((*si >> 5) & 1);
74 *(oi + 6) =
'0' + ((*si >> 6) & 1);
75 *(oi + 7) =
'0' + ((*si >> 7) & 1);
77 if (si + 1 != cdata + size) {
89 std::string
bitdump_be8(
const void*
const data,
size_t size) {
std::string bitdump_le8(const void *const data, size_t size)
deprecated method: unclear naming and documentation.
std::string bitdump_8_msb(const void *const data, size_t size)
Dump a (binary) string of 8-bit bytes as a sequence of '0' and '1' characters, with the most signific...
std::string bitdump_8_lsb(const void *const data, size_t size)
Dump a (binary) string of 8-bit bytes as a sequence of '0' and '1' characters, with the least signifi...
std::string bitdump_be8(const void *const data, size_t size)
deprecated method: unclear naming and documentation.