File tree 1 file changed +3
-3
lines changed
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 {
271
271
const rand = r .int (u64 );
272
272
var rand_lz = @clz (rand );
273
273
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 );
277
275
rand_lz = 41 + @clz (r .int (u64 ));
278
276
if (rand_lz == 41 + 64 ) {
277
+ @branchHint (.unlikely );
279
278
// It is astronomically unlikely to reach this point.
280
279
rand_lz += @clz (r .int (u32 ) | 0x7FF );
281
280
}
@@ -297,6 +296,7 @@ pub fn float(r: Random, comptime T: type) T {
297
296
const addl_rand_lz = @clz (r .int (u64 ));
298
297
rand_lz += addl_rand_lz ;
299
298
if (addl_rand_lz != 64 ) {
299
+ @branchHint (.likely );
300
300
break ;
301
301
}
302
302
if (rand_lz >= 1022 ) {
You can’t perform that action at this time.
0 commit comments