From 65534dca5e71cd81070e2e464060f023b9868600 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Tue, 27 May 2025 17:48:22 -0400 Subject: libmisc: fmt: Add hbyte and hmem --- libmisc/fmt.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'libmisc/fmt.c') diff --git a/libmisc/fmt.c b/libmisc/fmt.c index d3ca14a..a8baa84 100644 --- a/libmisc/fmt.c +++ b/libmisc/fmt.c @@ -28,6 +28,17 @@ void fmt_print_strn(lo_interface fmt_dest w, const char *str, size_t size) { fmt_print_byte(w, *(str++)); } +void fmt_print_hmem(lo_interface fmt_dest w, const void *_str, size_t size) { + const uint8_t *str = _str; + fmt_print_byte(w, '{'); + for (size_t i = 0; i < size; i++) { + if (i) + fmt_print_byte(w, ','); + fmt_print_hbyte(w, str[i]); + } + fmt_print_byte(w, '}'); +} + void fmt_print_byte(lo_interface fmt_dest w, uint8_t b) { LO_CALL(w, putb, b); } -- cgit v1.2.3-2-g168b