Simplified itoa

This commit is contained in:
Eduard Urbach 2024-07-31 13:37:46 +02:00
parent 87ae78c86a
commit 76c916018a
Signed by: akyoto
GPG Key ID: C874F672B1AF20C0
2 changed files with 4 additions and 3 deletions

View File

@ -6,6 +6,7 @@ A simple programming language.
* Fast compilation
* Small binaries
* High performance
## Installation

View File

@ -4,7 +4,8 @@ import sys
number(x) {
length := 20
buffer := mem.alloc(length)
itoa(x, buffer, length)
tmp := itoa(x, buffer, length)
sys.write(1, tmp, buffer + length - tmp)
mem.free(buffer, length)
}
@ -19,8 +20,7 @@ itoa(x, buffer, length) {
tmp[0] = '0' + digit
if x == 0 {
sys.write(1, tmp, end - tmp)
return
return tmp
}
}
}