diff options
| author | tison <wander4096@gmail.com> | 2023-05-24 08:01:48 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-24 00:01:48 +0000 |
| commit | bfe02ff61a8861c269524c60668a3969cb053720 (patch) | |
| tree | 92c6a412b5f25101c60217e9db80a53394c223bb /lib/std/math.zig | |
| parent | dcc1b4fd1532ccfe028fe9f68c0d19fc28800191 (diff) | |
| download | zig-bfe02ff61a8861c269524c60668a3969cb053720.tar.gz zig-bfe02ff61a8861c269524c60668a3969cb053720.zip | |
make `@boolToInt` always return a u1
Signed-off-by: tison <wander4096@gmail.com>
Diffstat (limited to 'lib/std/math.zig')
| -rw-r--r-- | lib/std/math.zig | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/std/math.zig b/lib/std/math.zig index 02b737610c..4221118ba5 100644 --- a/lib/std/math.zig +++ b/lib/std/math.zig @@ -1684,7 +1684,7 @@ pub fn break_f80(x: f80) F80 { pub inline fn sign(i: anytype) @TypeOf(i) { const T = @TypeOf(i); return switch (@typeInfo(T)) { - .Int, .ComptimeInt => @as(T, @boolToInt(i > 0)) - @boolToInt(i < 0), + .Int, .ComptimeInt => @as(T, @boolToInt(i > 0)) - @as(T, @boolToInt(i < 0)), .Float, .ComptimeFloat => @intToFloat(T, @boolToInt(i > 0)) - @intToFloat(T, @boolToInt(i < 0)), .Vector => |vinfo| blk: { switch (@typeInfo(vinfo.child)) { |
