22 lines
282 B
Plaintext
Raw Normal View History

2024-07-26 10:50:47 +00:00
import mem
import sys
2024-07-26 14:19:13 +00:00
number(x) {
2024-07-26 10:50:47 +00:00
length := 20
buffer := mem.alloc(length)
end := buffer + length
tmp := end
digit := 0
loop {
x, digit = x / 10
tmp -= 1
tmp[0] = '0' + digit
if x == 0 {
sys.write(1, tmp, end - tmp)
mem.free(buffer, length)
return
}
}
}