Changed libc structure, shouldn't've added anything new

This commit is contained in:
2024-10-19 15:11:00 +02:00
parent e2e24d3853
commit 64b4e47d73
38 changed files with 264 additions and 276 deletions
+20
View File
@@ -0,0 +1,20 @@
#include <string.h>
// Source: http://www.strudel.org.uk/itoa/
char* itoa(size_t val, int base) {
static char buf[32] = { 0 };
if (base == 0 || base > 16) { return NULL; }
if (val == 0) {
buf[0] = '0';
return buf;
}
int i;
for (i = 30; val && i; i--, val /= base) {
buf[i] = "0123456789abcdef"[val % base];
}
return &buf[i + 1];
}