authorgravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2021-04-23 19:19:44+02:00
committergravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2021-04-23 19:19:44+02:00
log9ac5f9820086f6760df321b0a1ffc60ec92c8ad8
tree2dbb0a28fb5c89e0cecbf775c6156a1b7a2b3bdd
parentcc8e49283d68075c4e842405d651d0d36b8d10af

std: Remove unneeded workaround

Now that -% works on unsigned integers at comptime this (clever) hack is not not needed anymore.

1 files changed, 0 insertions(+), 9 deletions(-)

lib/std/math.zig-9
......@@ -1349,15 +1349,6 @@ pub fn boolMask(comptime MaskInt: type, value: bool) callconv(.Inline) MaskInt {
13491349 return @bitCast(i1, @as(u1, @boolToInt(value)));
13501350 }
13511351
1352 // At comptime, -% is disallowed on unsigned values.
1353 // So we need to jump through some hoops in that case.
1354 // This is a workaround for #7951
1355 if (@typeInfo(@TypeOf(.{value})).Struct.fields[0].is_comptime) {
1356 // Since it's comptime, we don't need this to generate nice code.
1357 // We can just do a branch here.
1358 return if (value) ~@as(MaskInt, 0) else 0;
1359 }
1360
13611352 return -%@intCast(MaskInt, @boolToInt(value));
13621353}
13631354