mirror of
https://github.com/zama-ai/tfhe-rs.git
synced 2026-01-09 14:47:56 -05:00
chore(all): fix new lints
This commit is contained in:
@@ -53,7 +53,6 @@ impl ParallelRandomGenerator for AesniRandomGenerator {
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
mod test {
|
||||
use crate::generators::aes_ctr::aes_ctr_parallel_generic_tests;
|
||||
use crate::generators::implem::aesni::block_cipher::AesniBlockCipher;
|
||||
|
||||
@@ -14,7 +14,7 @@ fn make_digits(a: &impl BigInteger, w: usize, num_bits: usize) -> impl Iterator<
|
||||
} else {
|
||||
num_bits
|
||||
};
|
||||
let digits_count = (num_bits + w - 1) / w;
|
||||
let digits_count = num_bits.div_ceil(w) ;
|
||||
|
||||
(0..digits_count).map(move |i| {
|
||||
// Construct a buffer of bits of the scalar, starting at `bit_offset`.
|
||||
@@ -70,7 +70,7 @@ pub fn msm_wnaf_g1_446(
|
||||
(size.ilog2() as usize * 69 / 100) + 2
|
||||
};
|
||||
|
||||
let digits_count = (num_bits + c - 1) / c;
|
||||
let digits_count = num_bits.div_ceil(c);
|
||||
let scalar_digits = scalars
|
||||
.into_par_iter()
|
||||
.flat_map_iter(|s| make_digits(s, c, num_bits))
|
||||
|
||||
@@ -225,7 +225,7 @@ impl<Scalar: UnsignedInteger + CastInto<usize> + CastFrom<usize>>
|
||||
for ggsw_idx in 1..grouping_factor.ggsw_per_multi_bit_element().0 {
|
||||
// We need to store the diff sums of more than one element as we store the
|
||||
// individual modulus_switched elements
|
||||
if ggsw_idx.count_ones() == 1 {
|
||||
if ggsw_idx.is_power_of_two() {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -1695,8 +1695,6 @@ where
|
||||
{
|
||||
/// Performs a right bit rotation and assign operation on [FheInt]
|
||||
///
|
||||
/// # Note
|
||||
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
|
||||
@@ -638,12 +638,6 @@ pub unsafe fn unchecked_bitop_integer_radix_kb_assign_async<T: UnsignedInteger,
|
||||
);
|
||||
}
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
/// # Safety
|
||||
///
|
||||
/// - [CudaStreams::synchronize] __must__ be called after this function as soon as synchronization
|
||||
/// is required
|
||||
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
/// # Safety
|
||||
///
|
||||
|
||||
@@ -89,11 +89,7 @@ impl<'a> Comparator<'a> {
|
||||
.generate_lookup_table(|x| if x < message_modulus { x } else { 0 });
|
||||
|
||||
let rhs_lut = server_key.key.generate_lookup_table(|x| {
|
||||
if x >= message_modulus {
|
||||
x - message_modulus
|
||||
} else {
|
||||
0
|
||||
}
|
||||
x.saturating_sub(message_modulus)
|
||||
});
|
||||
|
||||
Self {
|
||||
|
||||
@@ -2701,7 +2701,7 @@ where
|
||||
let first_block_msg = first_block % block_msg_mod;
|
||||
let first_block_carry = first_block / block_msg_mod;
|
||||
assert_eq!(first_block_msg, (block_msg_mod - 1 + msg) % block_msg_mod);
|
||||
assert_eq!(first_block_carry, (block_msg_mod - 1 + msg) / block_msg_mod);
|
||||
assert_eq!(first_block_carry, msg.div_ceil(block_msg_mod));
|
||||
for b in &ct.blocks[1..] {
|
||||
let block = shortint_cks.decrypt_message_and_carry(b);
|
||||
let msg = block % block_msg_mod;
|
||||
|
||||
@@ -722,7 +722,7 @@ pub const BIVARIATE_PBS_COMPLIANT_PARAMETER_SET_VEC: [ClassicPBSParameters; 16]
|
||||
/// encoded over X (reps. Y) bits, i.e., message_modulus = 2^{X} (resp. carry_modulus = 2^{Y}).
|
||||
/// All parameter sets guarantee 128-bits of security and an error probability smaller than
|
||||
/// 2^{-40} for a PBS.
|
||||
|
||||
///
|
||||
/// Return a parameter set from a message and carry moduli.
|
||||
///
|
||||
/// # Example
|
||||
|
||||
@@ -276,7 +276,7 @@ impl ServerKey {
|
||||
pub fn is_neg_possible(&self, ct: CiphertextNoiseDegree) -> Result<(), CheckError> {
|
||||
// z = ceil( degree / 2^p ) x 2^p
|
||||
let msg_mod = self.message_modulus.0;
|
||||
let mut z = (ct.degree.get() + msg_mod - 1) / msg_mod;
|
||||
let mut z = ct.degree.get().div_ceil(msg_mod);
|
||||
z = z.wrapping_mul(msg_mod);
|
||||
|
||||
self.max_degree.validate(Degree::new(z))
|
||||
|
||||
@@ -183,7 +183,7 @@ impl ServerKey {
|
||||
) -> Result<(), CheckError> {
|
||||
// z = ceil( degree / 2^p ) x 2^p
|
||||
let msg_mod = self.message_modulus.0;
|
||||
let mut z = (ct_right.degree.get() + msg_mod - 1) / msg_mod;
|
||||
let mut z = ct_right.degree.get().div_ceil(msg_mod);
|
||||
z = z.wrapping_mul(msg_mod);
|
||||
|
||||
let final_operation_count = ct_left.degree.get() + z;
|
||||
|
||||
Reference in New Issue
Block a user