MCPcopy Create free account
hub / github.com/apache/singa / PrintByteSegmentInObjectTo

Function PrintByteSegmentInObjectTo

test/gtest/gtest-all.cc:9072–9088  ·  view source on GitHub ↗

Prints a segment of bytes in the given object.

Source from the content-addressed store, hash-verified

9070
9071// Prints a segment of bytes in the given object.
9072void PrintByteSegmentInObjectTo(const unsigned char* obj_bytes, size_t start,
9073 size_t count, ostream* os) {
9074 char text[5] = "";
9075 for (size_t i = 0; i != count; i++) {
9076 const size_t j = start + i;
9077 if (i != 0) {
9078 // Organizes the bytes into groups of 2 for easy parsing by
9079 // human.
9080 if ((j % 2) == 0)
9081 *os << ' ';
9082 else
9083 *os << '-';
9084 }
9085 GTEST_SNPRINTF_(text, sizeof(text), "%02X", obj_bytes[j]);
9086 *os << text;
9087 }
9088}
9089
9090// Prints the bytes in the given value to the given ostream.
9091void PrintBytesInObjectToImpl(const unsigned char* obj_bytes, size_t count,

Callers 1

PrintBytesInObjectToImplFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected