@@ -1376,9 +1376,9 @@ macro_rules! uint_impl {
1376
1376
}
1377
1377
// SAFETY: We just checked this is a power of two. and above zero.
1378
1378
let power_used = unsafe { intrinsics:: cttz_nonzero( self ) as u32 } ;
1379
- if exp > Self :: BITS / power_used { return None ; } // Division of constants is free
1379
+ if exp >= Self :: BITS / power_used { return None ; } // Division of constants is free
1380
1380
1381
- // SAFETY: exp <= Self::BITS / power_used
1381
+ // SAFETY: exp < Self::BITS / power_used
1382
1382
unsafe { Some ( intrinsics:: unchecked_shl(
1383
1383
1 as Self ,
1384
1384
intrinsics:: unchecked_mul( power_used, exp) as Self
@@ -1920,9 +1920,9 @@ macro_rules! uint_impl {
1920
1920
}
1921
1921
// SAFETY: We just checked this is a power of two. and above zero.
1922
1922
let power_used = unsafe { intrinsics:: cttz_nonzero( self ) as u32 } ;
1923
- if exp > Self :: BITS / power_used { return 0 ; } // Division of constants is free
1923
+ if exp >= Self :: BITS / power_used { return 0 ; } // Division of constants is free
1924
1924
1925
- // SAFETY: exp <= Self::BITS / power_used
1925
+ // SAFETY: exp < Self::BITS / power_used
1926
1926
unsafe { intrinsics:: unchecked_shl(
1927
1927
1 as Self ,
1928
1928
intrinsics:: unchecked_mul( power_used, exp) as Self
@@ -2395,9 +2395,9 @@ macro_rules! uint_impl {
2395
2395
}
2396
2396
// SAFETY: We just checked this is a power of two. and above zero.
2397
2397
let power_used = unsafe { intrinsics:: cttz_nonzero( self ) as u32 } ;
2398
- if exp > Self :: BITS / power_used { return ( 0 , true ) ; } // Division of constants is free
2398
+ if exp >= Self :: BITS / power_used { return ( 0 , true ) ; } // Division of constants is free
2399
2399
2400
- // SAFETY: exp <= Self::BITS / power_used
2400
+ // SAFETY: exp < Self::BITS / power_used
2401
2401
unsafe { ( intrinsics:: unchecked_shl(
2402
2402
1 as Self ,
2403
2403
intrinsics:: unchecked_mul( power_used, exp) as Self
@@ -2475,12 +2475,12 @@ macro_rules! uint_impl {
2475
2475
}
2476
2476
// SAFETY: We just checked this is a power of two. and above zero.
2477
2477
let power_used = unsafe { intrinsics:: cttz_nonzero( self ) as u32 } ;
2478
- if exp > Self :: BITS / power_used { // Division of constants is free
2478
+ if exp >= Self :: BITS / power_used { // Division of constants is free
2479
2479
#[ allow( arithmetic_overflow) ]
2480
2480
return Self :: MAX * Self :: MAX * 0 ;
2481
2481
}
2482
2482
2483
- // SAFETY: exp <= Self::BITS / power_used
2483
+ // SAFETY: exp < Self::BITS / power_used
2484
2484
unsafe { intrinsics:: unchecked_shl(
2485
2485
1 as Self ,
2486
2486
intrinsics:: unchecked_mul( power_used, exp) as Self
0 commit comments