mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-02 13:53:07 +00:00
Make clippy happy
Nightly has added more clippy rules.
This commit is contained in:
parent
d89966b076
commit
f92427021c
@ -82,12 +82,14 @@ impl Default for Avx2GoldilocksField {
|
||||
|
||||
impl Div<GoldilocksField> for Avx2GoldilocksField {
|
||||
type Output = Self;
|
||||
#[allow(clippy::suspicious_arithmetic_impl)]
|
||||
#[inline]
|
||||
fn div(self, rhs: GoldilocksField) -> Self {
|
||||
self * rhs.inverse()
|
||||
}
|
||||
}
|
||||
impl DivAssign<GoldilocksField> for Avx2GoldilocksField {
|
||||
#[allow(clippy::suspicious_op_assign_impl)]
|
||||
#[inline]
|
||||
fn div_assign(&mut self, rhs: GoldilocksField) {
|
||||
*self *= rhs.inverse();
|
||||
@ -318,8 +320,7 @@ unsafe fn add_no_double_overflow_64_64s_s(x: __m256i, y_s: __m256i) -> __m256i {
|
||||
let res_wrapped_s = _mm256_add_epi64(x, y_s);
|
||||
let mask = _mm256_cmpgt_epi64(y_s, res_wrapped_s); // -1 if overflowed else 0.
|
||||
let wrapback_amt = _mm256_srli_epi64::<32>(mask); // -FIELD_ORDER if overflowed else 0.
|
||||
let res_s = _mm256_add_epi64(res_wrapped_s, wrapback_amt);
|
||||
res_s
|
||||
_mm256_add_epi64(res_wrapped_s, wrapback_amt)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@ -337,8 +338,7 @@ unsafe fn sub(x: __m256i, y: __m256i) -> __m256i {
|
||||
let mask = _mm256_cmpgt_epi64(y_s, x_s); // -1 if sub will underflow (y > x) else 0.
|
||||
let wrapback_amt = _mm256_srli_epi64::<32>(mask); // -FIELD_ORDER if underflow else 0.
|
||||
let res_wrapped = _mm256_sub_epi64(x_s, y_s);
|
||||
let res = _mm256_sub_epi64(res_wrapped, wrapback_amt);
|
||||
res
|
||||
_mm256_sub_epi64(res_wrapped, wrapback_amt)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@ -427,8 +427,7 @@ unsafe fn add_small_64s_64_s(x_s: __m256i, y: __m256i) -> __m256i {
|
||||
let mask = _mm256_cmpgt_epi32(x_s, res_wrapped_s); // -1 if overflowed else 0.
|
||||
// The mask contains 0xffffffff in the high 32 bits if wraparound occured and 0 otherwise.
|
||||
let wrapback_amt = _mm256_srli_epi64::<32>(mask); // -FIELD_ORDER if overflowed else 0.
|
||||
let res_s = _mm256_add_epi64(res_wrapped_s, wrapback_amt);
|
||||
res_s
|
||||
_mm256_add_epi64(res_wrapped_s, wrapback_amt)
|
||||
}
|
||||
|
||||
/// Goldilocks subtraction of a "small" number. `x_s` is pre-shifted by 2**63. `y` is assumed to be
|
||||
@ -444,8 +443,7 @@ unsafe fn sub_small_64s_64_s(x_s: __m256i, y: __m256i) -> __m256i {
|
||||
let mask = _mm256_cmpgt_epi32(res_wrapped_s, x_s); // -1 if underflowed else 0.
|
||||
// The mask contains 0xffffffff in the high 32 bits if wraparound occured and 0 otherwise.
|
||||
let wrapback_amt = _mm256_srli_epi64::<32>(mask); // -FIELD_ORDER if underflowed else 0.
|
||||
let res_s = _mm256_sub_epi64(res_wrapped_s, wrapback_amt);
|
||||
res_s
|
||||
_mm256_sub_epi64(res_wrapped_s, wrapback_amt)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@ -456,8 +454,7 @@ unsafe fn reduce128(x: (__m256i, __m256i)) -> __m256i {
|
||||
let lo1_s = sub_small_64s_64_s(lo0_s, hi_hi0);
|
||||
let t1 = _mm256_mul_epu32(hi0, EPSILON);
|
||||
let lo2_s = add_small_64s_64_s(lo1_s, t1);
|
||||
let lo2 = shift(lo2_s);
|
||||
lo2
|
||||
shift(lo2_s)
|
||||
}
|
||||
|
||||
/// Multiply two integers modulo FIELD_ORDER.
|
||||
@ -628,6 +625,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::zero_prefixed_literal)]
|
||||
#[test]
|
||||
fn test_interleave() {
|
||||
let in_a: [GoldilocksField; 4] = [
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user