aboutsummaryrefslogtreecommitdiff
path: root/src/type.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-01-02 14:11:37 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-01-02 14:11:37 -0700
commitb4d6e85a339e971829404dc1a260bde4062735f8 (patch)
tree7debe384b184d4b8c24f3d35e2ec8a32b9da8cd0 /src/type.zig
parent6b14c58f63a177c26ed7ac51c25738ecb115462d (diff)
downloadzig-b4d6e85a339e971829404dc1a260bde4062735f8.tar.gz
zig-b4d6e85a339e971829404dc1a260bde4062735f8.zip
Sema: implement peer type resolution of signed and unsigned ints
This allows stage2 to build more of compiler-rt. I also changed `-%` to `-` for comptime ints in the div and mul implementations of compiler-rt. This is clearer code and also happens to work around a bug in stage2.
Diffstat (limited to 'src/type.zig')
-rw-r--r--src/type.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/type.zig b/src/type.zig
index 9de6bb25a8..b948093994 100644
--- a/src/type.zig
+++ b/src/type.zig
@@ -3106,9 +3106,9 @@ pub const Type = extern union {
.c_ulonglong => return .{ .signedness = .unsigned, .bits = CType.ulonglong.sizeInBits(target) },
.enum_full, .enum_nonexhaustive => ty = ty.cast(Payload.EnumFull).?.data.tag_ty,
- .enum_numbered => ty = self.castTag(.enum_numbered).?.data.tag_ty,
+ .enum_numbered => ty = ty.castTag(.enum_numbered).?.data.tag_ty,
.enum_simple => {
- const enum_obj = self.castTag(.enum_simple).?.data;
+ const enum_obj = ty.castTag(.enum_simple).?.data;
const field_count = enum_obj.fields.count();
if (field_count == 0) return .{ .signedness = .unsigned, .bits = 0 };
return .{ .signedness = .unsigned, .bits = smallestUnsignedBits(field_count - 1) };