diff --git a/src/support/hexdump.cc b/src/support/hexdump.cc index dc3d63ce6f59..6259815cddd6 100644 --- a/src/support/hexdump.cc +++ b/src/support/hexdump.cc @@ -28,7 +28,7 @@ namespace tvm { namespace support { -void hexdump(const std::string& s, std::ostream& os) { +void HexDump(const std::string& s, std::ostream& os) { os << std::hex << std::setfill('0') << std::right; int addr_width = 4; diff --git a/src/support/hexdump.h b/src/support/hexdump.h index 9efaec9d9a78..4d660c6d2bf7 100644 --- a/src/support/hexdump.h +++ b/src/support/hexdump.h @@ -32,11 +32,16 @@ namespace tvm { namespace support { -void hexdump(const std::string& s, std::ostream& os); +/*! \brief generate a hexdump of some binary data. + * \param s Binary data to print. + * \param os stream that receives the hexdump. + */ +void HexDump(const std::string& s, std::ostream& os); -inline std::string hexdump(const std::string& s) { +/*! \brief return a string containing a hexdump of the data in s */ +inline std::string HexDump(const std::string& s) { std::stringstream ss; - hexdump(s, ss); + HexDump(s, ss); return ss.str(); } diff --git a/tests/cpp/support_test.cc b/tests/cpp/support_test.cc index fa0ab28a988c..bc9b944c6550 100644 --- a/tests/cpp/support_test.cc +++ b/tests/cpp/support_test.cc @@ -25,13 +25,13 @@ namespace tvm { namespace test { -TEST(HexDumpTests, Empty) { EXPECT_EQ("", ::tvm::support::hexdump("")); } +TEST(HexDumpTests, Empty) { EXPECT_EQ("", ::tvm::support::HexDump("")); } TEST(HexDumpTests, Aligned) { EXPECT_EQ( "0000 01 23 45 67 89 ab cd ef 01 23 45 67 89 ab cd ef .#Eg.....#Eg....\n" "0010 01 23 45 67 89 ab cd ef 01 23 45 67 89 ab cd ef .#Eg.....#Eg....\n", - ::tvm::support::hexdump("\x01\x23\x45\x67\x89\xab\xcd\xef\x01\x23\x45\x67\x89\xab\xcd\xef" + ::tvm::support::HexDump("\x01\x23\x45\x67\x89\xab\xcd\xef\x01\x23\x45\x67\x89\xab\xcd\xef" "\x01\x23\x45\x67\x89\xab\xcd\xef\x01\x23\x45\x67\x89\xab\xcd\xef")); } @@ -39,7 +39,7 @@ TEST(HexDumpTests, Unaligned) { EXPECT_EQ( "0000 01 23 45 67 89 ab cd ef 01 23 45 67 89 ab cd ef .#Eg.....#Eg....\n" "0010 01 23 45 67 89 ab cd ef 01 .#Eg.....\n", - ::tvm::support::hexdump("\x01\x23\x45\x67\x89\xab\xcd\xef\x01\x23\x45\x67\x89\xab\xcd\xef" + ::tvm::support::HexDump("\x01\x23\x45\x67\x89\xab\xcd\xef\x01\x23\x45\x67\x89\xab\xcd\xef" "\x01\x23\x45\x67\x89\xab\xcd\xef\x01")); }