File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -1083,7 +1083,7 @@ pub(crate) unsafe fn align_offset<T: Sized>(p: *const T, a: usize) -> usize {
10831083 // anyway.
10841084 inverse = inverse. wrapping_mul ( 2usize . wrapping_sub ( x. wrapping_mul ( inverse) ) )
10851085 & ( going_mod - 1 ) ;
1086- if going_mod > m {
1086+ if going_mod >= m {
10871087 return inverse & ( m - 1 ) ;
10881088 }
10891089 going_mod = going_mod. wrapping_mul ( going_mod) ;
@@ -1134,7 +1134,7 @@ pub(crate) unsafe fn align_offset<T: Sized>(p: *const T, a: usize) -> usize {
11341134 // to take the result $o mod lcm(s, a)$. We can replace $lcm(s, a)$ with just a $a / g$.
11351135 let j = a. wrapping_sub ( pmoda) >> gcdpow;
11361136 let k = smoda >> gcdpow;
1137- return intrinsics :: unchecked_rem ( j. wrapping_mul ( mod_inv ( k, a) ) , a >> gcdpow) ;
1137+ return ( j. wrapping_mul ( mod_inv ( k, a) ) ) & ( ( a >> gcdpow) . wrapping_sub ( 1 ) ) ;
11381138 }
11391139
11401140 // Cannot be aligned at all.
You can’t perform that action at this time.
0 commit comments