aboutsummaryrefslogtreecommitdiff
path: root/src/Type.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/Type.zig')
-rw-r--r--src/Type.zig8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/Type.zig b/src/Type.zig
index 2048fc852b..0dfd12cb35 100644
--- a/src/Type.zig
+++ b/src/Type.zig
@@ -3040,8 +3040,7 @@ pub fn minInt(ty: Type, pt: Zcu.PerThread, dest_ty: Type) !Value {
pub fn minIntScalar(ty: Type, pt: Zcu.PerThread, dest_ty: Type) !Value {
const zcu = pt.zcu;
const info = ty.intInfo(zcu);
- if (info.signedness == .unsigned) return pt.intValue(dest_ty, 0);
- if (info.bits == 0) return pt.intValue(dest_ty, -1);
+ if (info.signedness == .unsigned or info.bits == 0) return pt.intValue(dest_ty, 0);
if (std.math.cast(u6, info.bits - 1)) |shift| {
const n = @as(i64, std.math.minInt(i64)) >> (63 - shift);
@@ -3072,10 +3071,7 @@ pub fn maxIntScalar(ty: Type, pt: Zcu.PerThread, dest_ty: Type) !Value {
const info = ty.intInfo(pt.zcu);
switch (info.bits) {
- 0 => return switch (info.signedness) {
- .signed => try pt.intValue(dest_ty, -1),
- .unsigned => try pt.intValue(dest_ty, 0),
- },
+ 0 => return pt.intValue(dest_ty, 0),
1 => return switch (info.signedness) {
.signed => try pt.intValue(dest_ty, 0),
.unsigned => try pt.intValue(dest_ty, 1),