File tree 1 file changed +2
-2
lines changed
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 {
1083
1083
// anyway.
1084
1084
inverse = inverse. wrapping_mul ( 2usize . wrapping_sub ( x. wrapping_mul ( inverse) ) )
1085
1085
& ( going_mod - 1 ) ;
1086
- if going_mod > m {
1086
+ if going_mod >= m {
1087
1087
return inverse & ( m - 1 ) ;
1088
1088
}
1089
1089
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 {
1134
1134
// to take the result $o mod lcm(s, a)$. We can replace $lcm(s, a)$ with just a $a / g$.
1135
1135
let j = a. wrapping_sub ( pmoda) >> gcdpow;
1136
1136
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 ) ) ;
1138
1138
}
1139
1139
1140
1140
// Cannot be aligned at all.
You can’t perform that action at this time.
0 commit comments