forked from PoliEcho-holding-org/kern
Changed libc structure, shouldn't've added anything new
This commit is contained in:
@@ -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];
|
||||
}
|
||||
Reference in New Issue
Block a user