From 4130562b1555cabe441efe9420cebe12e7ed8d39 Mon Sep 17 00:00:00 2001 From: Benji Dial Date: Sat, 13 Jan 2024 16:43:49 -0500 Subject: application loading --- kernel/terminal.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'kernel/terminal.cpp') diff --git a/kernel/terminal.cpp b/kernel/terminal.cpp index 59e1ee5..1074fe7 100644 --- a/kernel/terminal.cpp +++ b/kernel/terminal.cpp @@ -108,4 +108,14 @@ namespace mercury::kernel::terminal { } + static char hex_digits[] = "0123456789abcdef"; + + void put_int_hex(uint64_t n, int digits, bool with_dots) { + for (int digit = digits - 1; digit >= 0; --digit) { + put_char(hex_digits[(n >> (digit * 4)) & 0xf]); + if (with_dots && digit % 4 == 0 && digit != 0) + put_char('.'); + } + } + } -- cgit v1.2.3