Expand description
Integer-to-decimal ASCII without core::fmt.
core::fmt drags kilobytes of formatting machinery into a guest binary,
so every project that draws a score, a coordinate, or a cell value with
psx-font grew its own digit loop (gh-psx u32_dec, PSXcel write_dec /
write_u64, hl-psx fmt_i32, VoXide Decimal3, the magikarp example).
This module is that loop, once.
Each function renders right-to-left into a scratch tail of buf, then
returns the &str covering just the digits. Size buf with the matching
*_DEC_MAX constant and it can never fail; an undersized buffer panics
(slice bounds), which the guest panic handler reports with file:line.
Constants§
- I32_
DEC_ MAX - Maximum bytes
i32_deccan produce (sign + 10 digits). - U32_
DEC_ MAX - Maximum bytes
u32_deccan produce (u32::MAX= 10 digits). - U64_
DEC_ MAX - Maximum bytes
u64_deccan produce (u64::MAX= 20 digits).