diff options
| author | LemonBoy <thatlemon@gmail.com> | 2021-04-23 19:19:44 +0200 |
|---|---|---|
| committer | LemonBoy <thatlemon@gmail.com> | 2021-04-23 19:19:44 +0200 |
| commit | 9ac5f9820086f6760df321b0a1ffc60ec92c8ad8 (patch) | |
| tree | 2dbb0a28fb5c89e0cecbf775c6156a1b7a2b3bdd /lib/std | |
| parent | cc8e49283d68075c4e842405d651d0d36b8d10af (diff) | |
| download | zig-9ac5f9820086f6760df321b0a1ffc60ec92c8ad8.tar.gz zig-9ac5f9820086f6760df321b0a1ffc60ec92c8ad8.zip | |
std: Remove unneeded workaround
Now that -% works on unsigned integers at comptime this (clever) hack is
not not needed anymore.
Diffstat (limited to 'lib/std')
| -rw-r--r-- | lib/std/math.zig | 9 |
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)); } |
