aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-04-23 16:59:01 -0400
committerGitHub <noreply@github.com>2021-04-23 16:59:01 -0400
commita279f18bce488460f87f41545411fc964dcaa4b0 (patch)
treea8680bac63d2812ab764fe5ee4d49f60d08e0d30 /lib
parente86a1df9f23386cc315ac8055ecfe7a6465c5ee3 (diff)
parent9ac5f9820086f6760df321b0a1ffc60ec92c8ad8 (diff)
downloadzig-a279f18bce488460f87f41545411fc964dcaa4b0.tar.gz
zig-a279f18bce488460f87f41545411fc964dcaa4b0.zip
Merge pull request #8599 from LemonBoy/unsigned-neg
stage1: Allow wrapping negation on unsigned ints at comptime
Diffstat (limited to 'lib')
-rw-r--r--lib/std/math.zig9
1 files changed, 0 insertions, 9 deletions
diff --git a/lib/std/math.zig b/lib/std/math.zig
index d71cafe5ef..558f541c00 100644
--- a/lib/std/math.zig
+++ b/lib/std/math.zig
@@ -1349,15 +1349,6 @@ pub fn boolMask(comptime MaskInt: type, value: bool) callconv(.Inline) MaskInt {
return @bitCast(i1, @as(u1, @boolToInt(value)));
}
- // At comptime, -% is disallowed on unsigned values.
- // So we need to jump through some hoops in that case.
- // This is a workaround for #7951
- if (@typeInfo(@TypeOf(.{value})).Struct.fields[0].is_comptime) {
- // Since it's comptime, we don't need this to generate nice code.
- // We can just do a branch here.
- return if (value) ~@as(MaskInt, 0) else 0;
- }
-
return -%@intCast(MaskInt, @boolToInt(value));
}