diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-12-02 19:56:43 +0200 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-12-03 00:09:23 +0200 |
| commit | 0e38cc16d51178525e89774ce9151651b6a0e99a (patch) | |
| tree | 41e3768824dc156b70fccf506362f4fa7277e3ae /src/codegen.zig | |
| parent | 7f9e841f746bb3eaf6ac205092a30bc7ed12a068 (diff) | |
| download | zig-0e38cc16d51178525e89774ce9151651b6a0e99a.tar.gz zig-0e38cc16d51178525e89774ce9151651b6a0e99a.zip | |
Sema: fix comparisons between lazy and runtime values
Closes #12498
Diffstat (limited to 'src/codegen.zig')
| -rw-r--r-- | src/codegen.zig | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/codegen.zig b/src/codegen.zig index 5a28ce1860..0a20153396 100644 --- a/src/codegen.zig +++ b/src/codegen.zig @@ -459,7 +459,7 @@ pub fn generateSymbol( if (info.bits <= 8) { const x: u8 = switch (info.signedness) { .unsigned => @intCast(u8, typed_value.val.toUnsignedInt(target)), - .signed => @bitCast(u8, @intCast(i8, typed_value.val.toSignedInt())), + .signed => @bitCast(u8, @intCast(i8, typed_value.val.toSignedInt(target))), }; try code.append(x); return Result{ .appended = {} }; @@ -488,13 +488,13 @@ pub fn generateSymbol( }, .signed => { if (info.bits <= 16) { - const x = @intCast(i16, typed_value.val.toSignedInt()); + const x = @intCast(i16, typed_value.val.toSignedInt(target)); mem.writeInt(i16, try code.addManyAsArray(2), x, endian); } else if (info.bits <= 32) { - const x = @intCast(i32, typed_value.val.toSignedInt()); + const x = @intCast(i32, typed_value.val.toSignedInt(target)); mem.writeInt(i32, try code.addManyAsArray(4), x, endian); } else { - const x = typed_value.val.toSignedInt(); + const x = typed_value.val.toSignedInt(target); mem.writeInt(i64, try code.addManyAsArray(8), x, endian); } }, @@ -536,13 +536,13 @@ pub fn generateSymbol( }, .signed => { if (info.bits <= 16) { - const x = @intCast(i16, int_val.toSignedInt()); + const x = @intCast(i16, int_val.toSignedInt(target)); mem.writeInt(i16, try code.addManyAsArray(2), x, endian); } else if (info.bits <= 32) { - const x = @intCast(i32, int_val.toSignedInt()); + const x = @intCast(i32, int_val.toSignedInt(target)); mem.writeInt(i32, try code.addManyAsArray(4), x, endian); } else { - const x = int_val.toSignedInt(); + const x = int_val.toSignedInt(target); mem.writeInt(i64, try code.addManyAsArray(8), x, endian); } }, |
