diff --git a/crates/clmul/src/backend/soft32.rs b/crates/clmul/src/backend/soft32.rs index 5a0d57f1..ea999a92 100644 --- a/crates/clmul/src/backend/soft32.rs +++ b/crates/clmul/src/backend/soft32.rs @@ -188,5 +188,5 @@ fn rev32(mut x: u32) -> u32 { x = ((x & 0x3333_3333) << 2) | (x >> 2 & 0x3333_3333); x = ((x & 0x0f0f_0f0f) << 4) | (x >> 4 & 0x0f0f_0f0f); x = ((x & 0x00ff_00ff) << 8) | (x >> 8 & 0x00ff_00ff); - (x << 16) | (x >> 16) + x.rotate_right(16) } diff --git a/crates/clmul/src/backend/soft64.rs b/crates/clmul/src/backend/soft64.rs index 217e1998..4edc570e 100644 --- a/crates/clmul/src/backend/soft64.rs +++ b/crates/clmul/src/backend/soft64.rs @@ -113,5 +113,5 @@ fn rev64(mut x: u64) -> u64 { x = ((x & 0x0f0f_0f0f_0f0f_0f0f) << 4) | ((x >> 4) & 0x0f0f_0f0f_0f0f_0f0f); x = ((x & 0x00ff_00ff_00ff_00ff) << 8) | ((x >> 8) & 0x00ff_00ff_00ff_00ff); x = ((x & 0xffff_0000_ffff) << 16) | ((x >> 16) & 0xffff_0000_ffff); - (x << 32) | (x >> 32) + x.rotate_right(32) } diff --git a/crates/mpz-circuits/src/tracer.rs b/crates/mpz-circuits/src/tracer.rs index 2bc9a269..21ee77e4 100644 --- a/crates/mpz-circuits/src/tracer.rs +++ b/crates/mpz-circuits/src/tracer.rs @@ -55,7 +55,7 @@ where } } -impl<'a> Tracer<'a, Bit> { +impl Tracer<'_, Bit> { /// Returns the single node associated with the bit. pub fn node(&self) -> Node { self.to_inner().nodes()[0] diff --git a/crates/mpz-common/src/sync/async_syncer.rs b/crates/mpz-common/src/sync/async_syncer.rs index 86cee84e..627dad36 100644 --- a/crates/mpz-common/src/sync/async_syncer.rs +++ b/crates/mpz-common/src/sync/async_syncer.rs @@ -132,7 +132,7 @@ impl<'a, Fut> Wait<'a, Fut> { } } -impl<'a, Fut> Future for Wait<'a, Fut> +impl Future for Wait<'_, Fut> where Fut: Future, { diff --git a/crates/mpz-common/src/sync/mod.rs b/crates/mpz-common/src/sync/mod.rs index 09d62038..6ce685f0 100644 --- a/crates/mpz-common/src/sync/mod.rs +++ b/crates/mpz-common/src/sync/mod.rs @@ -146,7 +146,7 @@ impl<'a, F> Wait<'a, F> { } } -impl<'a, F, R> Future for Wait<'a, F> +impl Future for Wait<'_, F> where F: FnOnce() -> R + Unpin, R: Unpin, diff --git a/crates/mpz-core/src/lpn.rs b/crates/mpz-core/src/lpn.rs index 2543fdb2..f7f83070 100644 --- a/crates/mpz-core/src/lpn.rs +++ b/crates/mpz-core/src/lpn.rs @@ -64,7 +64,7 @@ impl LpnEncoder { #[inline] fn compute_one_row(&self, y: &mut [Block], x: &[Block], pos: usize, prp: &Prp) { - let block_size = (D + 4 - 1) / 4; + let block_size = D.div_ceil(4); let mut index = (0..block_size) .map(|i| Block::from(bytemuck::cast::<_, [u8; 16]>([pos as u64, i as u64]))) .collect::>(); diff --git a/crates/mpz-garble-core/src/evaluator.rs b/crates/mpz-garble-core/src/evaluator.rs index f503ef0e..ed9b434a 100644 --- a/crates/mpz-garble-core/src/evaluator.rs +++ b/crates/mpz-garble-core/src/evaluator.rs @@ -85,7 +85,7 @@ impl Evaluator { &'a mut self, circ: &'a Circuit, inputs: Vec>, - ) -> Result>, EvaluatorError> { + ) -> Result>, EvaluatorError> { if inputs.len() != circ.inputs().len() { return Err(CircuitError::InvalidInputCount( circ.inputs().len(), @@ -129,7 +129,7 @@ impl Evaluator { &'a mut self, circ: &'a Circuit, inputs: Vec>, - ) -> Result>, EvaluatorError> { + ) -> Result>, EvaluatorError> { self.evaluate(circ, inputs).map(EncryptedGateBatchConsumer) } } @@ -156,7 +156,7 @@ pub struct EncryptedGateConsumer<'a, I: Iterator> { complete: bool, } -impl<'a, I: Iterator> fmt::Debug for EncryptedGateConsumer<'a, I> { +impl fmt::Debug for EncryptedGateConsumer<'_, I> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "EncryptedGateConsumer {{ .. }}") } diff --git a/crates/mpz-garble-core/src/generator.rs b/crates/mpz-garble-core/src/generator.rs index cfcc99f9..3d57fc21 100644 --- a/crates/mpz-garble-core/src/generator.rs +++ b/crates/mpz-garble-core/src/generator.rs @@ -96,7 +96,7 @@ impl Generator { circ: &'a Circuit, delta: Delta, inputs: Vec>, - ) -> Result>, GeneratorError> { + ) -> Result>, GeneratorError> { if inputs.len() != circ.inputs().len() { return Err(CircuitError::InvalidInputCount( circ.inputs().len(), @@ -143,7 +143,7 @@ impl Generator { circ: &'a Circuit, delta: Delta, inputs: Vec>, - ) -> Result>, GeneratorError> { + ) -> Result>, GeneratorError> { self.generate(circ, delta, inputs) .map(EncryptedGateBatchIter) } @@ -173,7 +173,7 @@ pub struct EncryptedGateIter<'a, I> { complete: bool, } -impl<'a, I> fmt::Debug for EncryptedGateIter<'a, I> { +impl fmt::Debug for EncryptedGateIter<'_, I> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "EncryptedGateIter {{ .. }}") } diff --git a/crates/mpz-ot-core/src/ferret/mpcot/receiver_regular.rs b/crates/mpz-ot-core/src/ferret/mpcot/receiver_regular.rs index 2b226108..0233ffb2 100644 --- a/crates/mpz-ot-core/src/ferret/mpcot/receiver_regular.rs +++ b/crates/mpz-ot-core/src/ferret/mpcot/receiver_regular.rs @@ -47,7 +47,7 @@ impl Receiver { } // The range of each interval. - let k = (n + t - 1) / t; + let k = n.div_ceil(t); let queries_length = if n % t == 0 { vec![k as usize; t as usize] diff --git a/crates/mpz-ot-core/src/ferret/mpcot/sender_regular.rs b/crates/mpz-ot-core/src/ferret/mpcot/sender_regular.rs index db0646b6..34757375 100644 --- a/crates/mpz-ot-core/src/ferret/mpcot/sender_regular.rs +++ b/crates/mpz-ot-core/src/ferret/mpcot/sender_regular.rs @@ -50,7 +50,7 @@ impl Sender { } // The range of each interval. - let k = (n + t - 1) / t; + let k = n.div_ceil(t); let queries_length = if n % t == 0 { vec![k as usize; t as usize]