summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2024-09-09 15:15:00 +1000
committerjacqueline <me@jacqueline.id.au>2024-09-09 15:15:00 +1000
commit2b1a01705d62d08cefd6816ba108c5cae48a50ac (patch)
tree20ba16a6259ffc335dbcded84fa6bcbe327e9d84 /src/util
parent9475d10d1000c7e21a7ea311b0c8ee6a72ef46c4 (diff)
parentacdc9789c90ed6f083d054cd07930e020123457f (diff)
downloadtangara-fw-2b1a01705d62d08cefd6816ba108c5cae48a50ac.tar.gz
Merge branch 'main' into jqln/tts
Diffstat (limited to 'src/util')
-rw-r--r--src/util/CMakeLists.txt3
-rw-r--r--src/util/include/debug.hpp13
2 files changed, 13 insertions, 3 deletions
diff --git a/src/util/CMakeLists.txt b/src/util/CMakeLists.txt
index 49554be8..90778c5d 100644
--- a/src/util/CMakeLists.txt
+++ b/src/util/CMakeLists.txt
@@ -2,4 +2,5 @@
#
# SPDX-License-Identifier: GPL-3.0-only
-idf_component_register(SRCS INCLUDE_DIRS "include" REQUIRES "memory")
+idf_component_register(
+ SRCS "random.cpp" INCLUDE_DIRS "include" REQUIRES "memory" "komihash")
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