strconv: reject overflow before arithmetic

This commit is contained in:
2026-08-09 17:50:47 +09:00
parent 8e2e6ae162
commit 976dc8a813
6 changed files with 118 additions and 19 deletions

View File

@@ -48,8 +48,6 @@
package strconv;
import os;
// ref/hare/strconv/decimal.ha:5.
def maxshift: u8 = 60u8;
@@ -59,7 +57,7 @@ def decimal_point_range: u16 = 2047u16;
// ref/hare/strconv/decimal.ha:8-26. Field layout 1:1. The 800-digit
// bound covers subnormal doubles (min exp -1074, max mantissa 4e16
// → at most 767 digits; 800 leaves headroom).
export type decimal = struct {
type decimal = struct {
digits: [800]u8,
nd: size,
dp: i32,