commit a5ecffa4617ea5ceed1edfe76b74896e7c249a2d (tree)
parent 8e1aa72c69cddc9fcd0bd8a3f9f4e9d3a8d002af
Author: Sizhe Zhao <prc.zhao@outlook.com>
Date: Sun, 10 Oct 2021 09:54:53 +0800
rand: remove workaround for issue #1770
Diffstat:
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/lib/std/rand.zig b/lib/std/rand.zig
@@ -111,10 +111,7 @@ pub const Random = struct {
var m: Large = @as(Large, x) * @as(Large, less_than);
var l: Small = @truncate(Small, m);
if (l < less_than) {
- // TODO: workaround for https://github.com/ziglang/zig/issues/1770
- // should be:
- // var t: Small = -%less_than;
- var t: Small = @bitCast(Small, -%@bitCast(std.meta.Int(.signed, small_bits), @as(Small, less_than)));
+ var t: Small = -%less_than;
if (t >= less_than) {
t -= less_than;