Commit 3817420d42

Andrew Kelley <andrew@ziglang.org>
2020-04-18 20:41:33
ziggurat uses `@truncate` instead of `& 0xff`
This makes it work on 32-bit targets. closes #2939
1 parent ca38b18
Changed files (1)
lib
std
lib/std/rand/ziggurat.zig
@@ -17,7 +17,7 @@ pub fn next_f64(random: *Random, comptime tables: ZigTable) f64 {
         // We manually construct a float from parts as we can avoid an extra random lookup here by
         // using the unused exponent for the lookup table entry.
         const bits = random.int(u64);
-        const i = @as(usize, bits & 0xff);
+        const i = @as(usize, @truncate(u8, bits));
 
         const u = blk: {
             if (tables.is_symmetric) {