From 8bc2ed4c49e6aeacd9797b962da1be411aa4c287 Mon Sep 17 00:00:00 2001 From: agra Date: Sat, 30 May 2026 00:30:48 +0300 Subject: [PATCH] ir: bridgeType non-standard int widths intern the exact width, not s64 A signed/unsigned width other than 8/16/32/64 quantised to s64/u64, silently changing the size. Intern the exact .signed/.unsigned width instead (the IR supports arbitrary-width ints). The default tagged-union tag width (tag_type orelse .s64) is kept -- it is a defined language default, not a failed lookup. 236 + unit green. --- src/ir/type_bridge.zig | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ir/type_bridge.zig b/src/ir/type_bridge.zig index dfbea28..64e4531 100644 --- a/src/ir/type_bridge.zig +++ b/src/ir/type_bridge.zig @@ -79,14 +79,16 @@ pub fn bridgeType(ty: sx_types.Type, table: *TypeTable) TypeId { 16 => .s16, 32 => .s32, 64 => .s64, - else => .s64, + // Non-standard width: intern the exact width rather than quantising + // to s64 (which would silently change the type's size). + else => table.intern(.{ .signed = w }), }, .unsigned => |w| switch (w) { 8 => .u8, 16 => .u16, 32 => .u32, 64 => .u64, - else => .u64, + else => table.intern(.{ .unsigned = w }), }, .f32 => .f32, .f64 => .f64,