diff options
| author | Laytan <laytanlaats@hotmail.com> | 2025-12-20 21:18:33 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-20 21:18:33 +0100 |
| commit | 40267e3a7a66766b0562853f3ad219e08cb2fc20 (patch) | |
| tree | 4715f0bedffe862f500d6e0398bfef50804079c6 /base/runtime | |
| parent | 17b7491acc753d3a63cf8cd82fd7fd6742ae7f03 (diff) | |
| parent | cbe164c596b693bd347c8f3e3182a4f1320b1fad (diff) | |
Merge pull request #6024 from blob1807/master
[`base:runtime`] fix `print_i64` using an OOB index when `min(i64)` is given.
Diffstat (limited to 'base/runtime')
| -rw-r--r-- | base/runtime/print.odin | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/base/runtime/print.odin b/base/runtime/print.odin index 90119c699..4ef142037 100644 --- a/base/runtime/print.odin +++ b/base/runtime/print.odin @@ -184,10 +184,11 @@ print_rune :: #force_no_inline proc "contextless" (r: rune) -> int #no_bounds_ch print_u64 :: #force_no_inline proc "contextless" (x: u64) #no_bounds_check { + b :: u64(10) + u := x + a: [129]byte i := len(a) - b := u64(10) - u := x for u >= b { i -= 1; a[i] = _INTEGER_DIGITS_VAR[u % b] u /= b @@ -199,11 +200,9 @@ print_u64 :: #force_no_inline proc "contextless" (x: u64) #no_bounds_check { print_i64 :: #force_no_inline proc "contextless" (x: i64) #no_bounds_check { - b :: i64(10) - - u := x - neg := u < 0 - u = abs(u) + b :: u64(10) + u := u64(abs(x)) + neg := x < 0 a: [129]byte i := len(a) |