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.
This commit is contained in:
@@ -79,14 +79,16 @@ pub fn bridgeType(ty: sx_types.Type, table: *TypeTable) TypeId {
|
|||||||
16 => .s16,
|
16 => .s16,
|
||||||
32 => .s32,
|
32 => .s32,
|
||||||
64 => .s64,
|
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) {
|
.unsigned => |w| switch (w) {
|
||||||
8 => .u8,
|
8 => .u8,
|
||||||
16 => .u16,
|
16 => .u16,
|
||||||
32 => .u32,
|
32 => .u32,
|
||||||
64 => .u64,
|
64 => .u64,
|
||||||
else => .u64,
|
else => table.intern(.{ .unsigned = w }),
|
||||||
},
|
},
|
||||||
.f32 => .f32,
|
.f32 => .f32,
|
||||||
.f64 => .f64,
|
.f64 => .f64,
|
||||||
|
|||||||
Reference in New Issue
Block a user