diff options
author | Benji Dial <benji6283@gmail.com> | 2021-01-24 12:00:11 -0500 |
---|---|---|
committer | Benji Dial <benji6283@gmail.com> | 2021-01-24 12:00:11 -0500 |
commit | bce944d1498eaa3b6940ee234c863b3548a66b37 (patch) | |
tree | ea40c087ab4f0f236aee8d158cf68550f5209f72 /src/kernel/util.c | |
parent | ca731aa747214919df7b3dfe3478dbe787ce5b68 (diff) | |
download | portland-os-bce944d1498eaa3b6940ee234c863b3548a66b37.tar.gz |
graphics!
Diffstat (limited to 'src/kernel/util.c')
-rw-r--r-- | src/kernel/util.c | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/src/kernel/util.c b/src/kernel/util.c index 625622a..ea0496e 100644 --- a/src/kernel/util.c +++ b/src/kernel/util.c @@ -39,97 +39,4 @@ void fmcpy(void *to, const struct drive *d, file_id_t f, uint32_t from, uint32_t d->load_sector(d, f, fsi, buf); memcpy(to + i, buf, n); -} - -void u32_dec(uint32_t n, char *b) { - if (!n) { - *(uint16_t *)b = (uint16_t)'0'; - return; - } - bool zero = false; - for (uint32_t m = 1000000000; m; m /= 10) { - uint8_t d = (n / m) % 10; - if (zero) - *(b++) = d + '0'; - else if (d) { - zero = true; - *(b++) = d + '0'; - } - } - *b = '\0'; -} - -void u16_dec(uint16_t n, char *b) { - if (!n) { - *(uint16_t *)b = (uint16_t)'0'; - return; - } - bool zero = false; - for (uint32_t m = 10000; m; m /= 10) { - uint8_t d = (n / m) % 10; - if (zero) - *(b++) = d + '0'; - else if (d) { - zero = true; - *(b++) = d + '0'; - } - } - *b = '\0'; -} - -void u8_dec(uint8_t n, char *b) { - if (!n) { - *(uint16_t *)b = (uint16_t)'0'; - return; - } - bool zero = false; - for (uint32_t m = 100; m; m /= 10) { - uint8_t d = (n / m) % 10; - if (zero) - *(b++) = d + '0'; - else if (d) { - zero = true; - *(b++) = d + '0'; - } - } - *b = '\0'; -} - -void u32_hex(uint32_t n, char *b) { - uint8_t m = 28; - while (1) { - uint8_t d = (n >> m) & 0xf; - *(b++) = d >= 10 ? 'a' + d - 10 : '0' + d; - if (!m) { - *b = '\0'; - return; - } - m -= 4; - } -} - -void u16_hex(uint16_t n, char *b) { - uint8_t m = 12; - while (1) { - uint8_t d = (n >> m) & 0xf; - *(b++) = d >= 10 ? 'a' + d - 10 : '0' + d; - if (!m) { - *b = '\0'; - return; - } - m -= 4; - } -} - -void u8_hex(uint8_t n, char *b) { - uint8_t m = 4; - while (1) { - uint8_t d = (n >> m) & 0xf; - *(b++) = d >= 10 ? 'a' + d - 10 : '0' + d; - if (!m) { - *b = '\0'; - return; - } - m -= 4; - } }
\ No newline at end of file |