fixed vec_znx.rsh

This commit is contained in:
Jean-Philippe Bossuat
2025-03-05 16:11:41 +01:00
parent e149aa584a
commit 97a1559bf2
2 changed files with 8 additions and 2 deletions

View File

@@ -475,13 +475,18 @@ pub fn rsh<T: VecZnxCommon>(log_base2k: usize, a: &mut T, k: usize, tmp_bytes: &
(cols_steps..cols).for_each(|i| {
izip!(carry_i64.iter_mut(), a.at_mut(i).iter_mut()).for_each(|(ci, xi)| {
*xi += *ci << log_base2k;
*ci = *xi & mask;
*xi /= 1 << k_rem;
*ci = get_base_k_carry(*xi, k_rem);
*xi = (*xi-*ci)>>k_rem;
});
})
}
}
#[inline(always)]
fn get_base_k_carry(x: i64, k: usize) -> i64{
(x<<64-k) >> (64-k)
}
pub trait VecZnxCommon: VecZnxApi + Infos {}
pub trait VecZnxOps {