diff options
author | Benji Dial <benji@benjidial.net> | 2024-01-13 16:43:49 -0500 |
---|---|---|
committer | Benji Dial <benji@benjidial.net> | 2024-01-13 16:43:49 -0500 |
commit | 4130562b1555cabe441efe9420cebe12e7ed8d39 (patch) | |
tree | beaf0012373aab2c3a13fe0147a5cda4af28ef78 /kernel/terminal.cpp | |
parent | 882e74b2191c059a9226cbd8bcb51c97da36247c (diff) | |
download | hilbert-os-4130562b1555cabe441efe9420cebe12e7ed8d39.tar.gz |
application loading
Diffstat (limited to 'kernel/terminal.cpp')
-rw-r--r-- | kernel/terminal.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
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('.'); + } + } + } |