summaryrefslogtreecommitdiff
path: root/src/user/knob
diff options
context:
space:
mode:
authorBenji Dial <benji6283@gmail.com>2020-09-06 15:47:06 -0400
committerBenji Dial <benji6283@gmail.com>2020-09-06 15:47:06 -0400
commitb8284137d4e0eec11c78bc14047243fce6a51373 (patch)
tree5969602dc3d090b536edccbf34d33d46a300c192 /src/user/knob
parent73bb0e48640b842824a0b45fe4854df8ff7faf7b (diff)
downloadportland-os-b8284137d4e0eec11c78bc14047243fce6a51373.tar.gz
minor changes, redoing makefile, meminfo program
Diffstat (limited to 'src/user/knob')
-rw-r--r--src/user/knob/format.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/user/knob/format.c b/src/user/knob/format.c
index f55e857..087f6fd 100644
--- a/src/user/knob/format.c
+++ b/src/user/knob/format.c
@@ -10,4 +10,22 @@ bool try_sntoi(const char *s, uint32_t n, uint32_t *out) {
}
*out = calc;
return true;
+}
+
+void itosz(uint32_t i, char *out) {
+ if (!i) {
+ *(uint16_t *)out = (uint16_t)'0';
+ return;
+ }
+ bool zero = false;
+ for (uint32_t m = 1000000000; m; m /= 10) {
+ uint8_t d = (i / m) % 10;
+ if (zero)
+ *(out++) = d + '0';
+ else if (d) {
+ zero = true;
+ *(out++) = d + '0';
+ }
+ }
+ *out = '\0';
} \ No newline at end of file