diff options
author | Benji Dial <benji6283@gmail.com> | 2020-09-13 17:12:29 -0400 |
---|---|---|
committer | Benji Dial <benji6283@gmail.com> | 2020-09-13 17:12:29 -0400 |
commit | 5481848e27fdd4fc859def9841a0283665531a46 (patch) | |
tree | 990a8df008214d85141a3bd10bd96898e64b0c37 /src/user/knob/format.c | |
parent | 1e4a254674f668839e5de273916024c16814b045 (diff) | |
download | portland-os-5481848e27fdd4fc859def9841a0283665531a46.tar.gz |
fixed some paging bugs, added fault handlers and new programs
Diffstat (limited to 'src/user/knob/format.c')
-rw-r--r-- | src/user/knob/format.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/user/knob/format.c b/src/user/knob/format.c index 087f6fd..645fb73 100644 --- a/src/user/knob/format.c +++ b/src/user/knob/format.c @@ -28,4 +28,18 @@ void itosz(uint32_t i, char *out) { } } *out = '\0'; +} + +const char *const hex_digits = "0123456789abcdef"; + +void itosz_h8(uint8_t i, char *out) { + out[0] = hex_digits[i >> 4]; + out[1] = hex_digits[i & 0xf]; + out[2] = '\0'; +} + +void itosz_h32(uint32_t i, char *out) { + for (uint8_t digit = 0; digit < 8; ++digit) + out[digit] = hex_digits[(i >> (28 - digit * 4)) & 0xf]; + out[8] = '\0'; }
\ No newline at end of file |