types: add SIZE/UINTPTR limit constants

Faithful port of ref/hare/types/arch+x86_64.ha:16-26. SIZE_MAX is the
no-cast `def SIZE_MAX: size = U64_MAX;` — size is in the unsigned class
and 8B on amd64, so the u64->size init coerces without a cast (#113);
UINTPTR_MAX keeps Hare's explicit `U64_MAX: uintptr` since uintptr is
outside the unsigned class. Probe 958_types_sizelim_run asserts MIN==0,
MAX==U64_MAX, and arithmetic usability for both types.

INT_MIN/MAX + UINT_MIN/MAX deferred to #114 (ww int=8B vs Hare 4B on
amd64 leaves the value open); RUNE_MAX deferred to #112 (no \U lexer).
combined.ww regenerated for all 5 selfhost tools + smoke.combined.ww
(all embed lib/types).
This commit is contained in:
2026-05-26 03:03:24 +09:00
parent 5e4d67d90a
commit b1c598651f
9 changed files with 207 additions and 0 deletions

View File

@@ -776,6 +776,14 @@ def U16_MIN: u16 = 0;
def U32_MIN: u32 = 0;
def U64_MIN: u64 = 0;
// size is 8B on amd64; no cast needed (size ∈ unsigned class per #113).
def SIZE_MIN: size = U64_MIN;
def SIZE_MAX: size = U64_MAX;
// uintptr not in the unsigned class, so the cast is required (Hare's form).
def UINTPTR_MIN: uintptr = U64_MIN: uintptr;
def UINTPTR_MAX: uintptr = U64_MAX: uintptr;
def RUNE_MIN: rune = '\0';
// bytes — slice operations over []u8. Mirrors Hare's bytes module