aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.zig
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2022-05-23 23:07:12 +0200
committerAndrew Kelley <andrew@ziglang.org>2022-05-24 15:34:52 -0700
commit41f517e5f506500c4e3f0bea53d73db0a1daf456 (patch)
treef0eb1bcce81e29e8aa732611c5acd7db5699a7e6 /src/codegen.zig
parentb42100c70fc306c6d6f69a55e9225a9a91e363ef (diff)
downloadzig-41f517e5f506500c4e3f0bea53d73db0a1daf456.tar.gz
zig-41f517e5f506500c4e3f0bea53d73db0a1daf456.zip
x64: update for new error union layout
Diffstat (limited to 'src/codegen.zig')
-rw-r--r--src/codegen.zig5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/codegen.zig b/src/codegen.zig
index eea8095a62..4f400fa7fc 100644
--- a/src/codegen.zig
+++ b/src/codegen.zig
@@ -442,7 +442,10 @@ pub fn generateSymbol(
.Int => {
const info = typed_value.ty.intInfo(target);
if (info.bits <= 8) {
- const x = @intCast(u8, typed_value.val.toUnsignedInt(target));
+ const x: u8 = switch (info.signedness) {
+ .unsigned => @intCast(u8, typed_value.val.toUnsignedInt(target)),
+ .signed => @bitCast(u8, @intCast(i8, typed_value.val.toSignedInt())),
+ };
try code.append(x);
return Result{ .appended = {} };
}