Skip to content

Commit

Permalink
rand: remove workaround for issue ziglang#1770
Browse files Browse the repository at this point in the history
  • Loading branch information
Prince213 committed Oct 10, 2021
1 parent 8e1aa72 commit bc66295
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions lib/std/rand.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit bc66295

Please sign in to comment.