File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -271,11 +271,10 @@ pub fn float(r: Random, comptime T: type) T {
271271 const rand = r .int (u64 );
272272 var rand_lz = @clz (rand );
273273 if (rand_lz >= 41 ) {
274- // TODO: when #5177 or #489 is implemented,
275- // tell the compiler it is unlikely (1/2^41) to reach this point.
276- // (Same for the if branch and the f64 calculations below.)
274+ @branchHint (.unlikely );
277275 rand_lz = 41 + @clz (r .int (u64 ));
278276 if (rand_lz == 41 + 64 ) {
277+ @branchHint (.unlikely );
279278 // It is astronomically unlikely to reach this point.
280279 rand_lz += @clz (r .int (u32 ) | 0x7FF );
281280 }
@@ -297,6 +296,7 @@ pub fn float(r: Random, comptime T: type) T {
297296 const addl_rand_lz = @clz (r .int (u64 ));
298297 rand_lz += addl_rand_lz ;
299298 if (addl_rand_lz != 64 ) {
299+ @branchHint (.likely );
300300 break ;
301301 }
302302 if (rand_lz >= 1022 ) {
You can’t perform that action at this time.
0 commit comments