lang: rename signed integer types sN -> iN

Surface rename of the signed integer family: s1..s64 become i1..i64
(u1..u64, usize, isize unchanged). 'string' keeps the s-prefix arm in
name classification; width parsing moves to the i-prefix arm next to
isize.

Internal TypeId tags follow the surface (.s8/.s16/.s32/.s64 ->
.i8/.i16/.i32/.i64), as do mono-key mangle fragments (ptr_i64,
tu_i64_bool) and all display/diagnostic formatting (i{d}).

Migrated in the same sweep: stdlib + examples + issue repros + FFI C
companions (shared symbol names like ffi_id_i64), expected
stdout/stderr/ir snapshots, specs.md, readme.md, CLAUDE.md/AGENTS.md,
implementation_plan.md, docs/, issue writeups. Vendored stb_image and
historical flow state left untouched.

zig build test: 426/426; examples suite: 595/595.
This commit is contained in:
agra
2026-06-12 09:31:53 +03:00
parent 515ecebea7
commit d8076b9333
1054 changed files with 6836 additions and 6839 deletions

View File

@@ -6,7 +6,7 @@
// --- Slice & string allocation ---
cstring :: (size: s64) -> string {
cstring :: (size: i64) -> string {
raw := context.allocator.alloc_bytes(size + 1);
memset(raw, 0, size + 1);
s : string = ---;
@@ -15,7 +15,7 @@ cstring :: (size: s64) -> string {
s
}
alloc_slice :: ($T: Type, count: s64) -> []T {
alloc_slice :: ($T: Type, count: i64) -> []T {
raw := context.allocator.alloc_bytes(count * size_of(T));
memset(raw, 0, count * size_of(T));
s : []T = ---;
@@ -24,12 +24,12 @@ alloc_slice :: ($T: Type, count: s64) -> []T {
s
}
int_to_string :: (n: s64) -> string {
int_to_string :: (n: i64) -> string {
if n == 0 { return "0"; }
neg := n < 0;
// Extract digits straight from `n` without ever negating it: `0 - n`
// overflows for s64::MIN (its magnitude is unrepresentable as a
// positive s64). sx `%` truncates toward zero, so `n % 10` keeps n's
// overflows for i64::MIN (its magnitude is unrepresentable as a
// positive i64). sx `%` truncates toward zero, so `n % 10` keeps n's
// sign; take each remainder's absolute value for the digit.
tmp := cstring(20);
i := 19;
@@ -47,13 +47,13 @@ int_to_string :: (n: s64) -> string {
// Unsigned decimal of `n`'s 64 bits — renders the full u64 range
// (0 .. 18446744073709551615). Used by `any_to_string` for unsigned
// integer values, which an s64-based formatter would misread (e.g. a
// integer values, which an i64-based formatter would misread (e.g. a
// u64 all-ones value as -1).
uint_to_string :: (n: s64) -> string {
uint_to_string :: (n: i64) -> string {
if n == 0 { return "0"; }
// Long division by 10 across the four unsigned 16-bit limbs, most
// significant first. Each step folds the running remainder into the
// next limb; the per-step accumulator stays well within s64
// next limb; the per-step accumulator stays well within i64
// (max 9*65536 + 65535), so signed `/` and `%` are exact.
g := decompose_u16x4(n);
tmp := cstring(20);
@@ -80,8 +80,8 @@ bool_to_string :: (b: bool) -> string {
float_to_string :: (f: f64) -> string {
neg := f < 0.0;
v := if neg then 0.0 - f else f;
int_part := cast(s64) v;
frac := cast(s64) ((v - cast(f64) int_part) * 1000000.0);
int_part := cast(i64) v;
frac := cast(i64) ((v - cast(f64) int_part) * 1000000.0);
if frac < 0 { frac = 0 - frac; }
istr := int_to_string(int_part);
fstr := int_to_string(frac);
@@ -103,7 +103,7 @@ float_to_string :: (f: f64) -> string {
buf
}
hex_group :: (buf: string, offset: s64, val: s64) {
hex_group :: (buf: string, offset: i64, val: i64) {
i := offset + 3;
v := val;
while i >= offset {
@@ -120,7 +120,7 @@ hex_group :: (buf: string, offset: s64, val: s64) {
// back into 0..65535 — so callers get correct unsigned arithmetic out
// of a signed-only integer type. Shared by the hex and unsigned-decimal
// formatters.
decompose_u16x4 :: (n: s64) -> [4]s64 {
decompose_u16x4 :: (n: i64) -> [4]i64 {
g0 := n % 65536;
if g0 < 0 { g0 = g0 + 65536; }
r1 := (n - g0) / 65536;
@@ -132,7 +132,7 @@ decompose_u16x4 :: (n: s64) -> [4]s64 {
r3 := (r2 - g2) / 65536;
g3 := r3 % 65536;
if g3 < 0 { g3 = g3 + 65536; }
limbs : [4]s64 = ---;
limbs : [4]i64 = ---;
limbs[0] = g3;
limbs[1] = g2;
limbs[2] = g1;
@@ -140,7 +140,7 @@ decompose_u16x4 :: (n: s64) -> [4]s64 {
limbs
}
int_to_hex_string :: (n: s64) -> string {
int_to_hex_string :: (n: i64) -> string {
if n == 0 { return "0"; }
g := decompose_u16x4(n);
@@ -168,7 +168,7 @@ concat :: (a: string, b: string) -> string {
buf
}
substr :: (s: string, start: s64, len: s64) -> string {
substr :: (s: string, start: i64, len: i64) -> string {
buf := cstring(len);
memcpy(buf.ptr, @s[start], len);
buf
@@ -251,14 +251,14 @@ slice_to_string :: (items: []$T) -> string {
}
pointer_to_string :: (p: $T) -> string {
addr : s64 = xx p;
addr : i64 = xx p;
if addr == 0 { "null" } else {
concat(type_name(T), concat("@0x", int_to_hex_string(addr)))
}
}
flags_to_string :: (val: $T) -> string {
v := cast(s64) val;
v := cast(i64) val;
result := "";
i := 0;
while i < field_count(T) {