summaryrefslogtreecommitdiff
path: root/src/util/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/include')
-rw-r--r--src/util/include/debug.hpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/util/include/debug.hpp b/src/util/include/debug.hpp
index 27fb2999..37c26f6a 100644
--- a/src/util/include/debug.hpp
+++ b/src/util/include/debug.hpp
@@ -6,6 +6,7 @@
#pragma once
+#include <cstdint>
#include <iomanip>
#include <ostream>
#include <span>
@@ -31,8 +32,8 @@ inline std::string format_hex_string(std::span<const std::byte> data) {
oss << " ";
}
int byte_val = (int)byte;
- oss << "[0x" << std::uppercase << std::setfill('0') << std::setw(2)
- << std::hex << byte_val << ']';
+ oss << std::uppercase << std::setfill('0') << std::setw(2) << std::hex
+ << byte_val << ' ';
if (byte_val >= 32 && byte_val < 127) {
ascii_values << (char)byte;
} else {
@@ -43,4 +44,12 @@ inline std::string format_hex_string(std::span<const std::byte> data) {
return oss.str();
}
+inline std::string format_hex_string(std::span<const uint8_t> data) {
+ return format_hex_string(std::as_bytes(data));
+}
+
+inline std::string format_hex_string(std::span<const char> data) {
+ return format_hex_string(std::as_bytes(data));
+}
+
} // namespace util