Use u64 instead of usize

This commit is contained in:
wborgeaud 2022-09-29 15:24:43 +02:00
parent 0aecc2a3cf
commit ee54b295d9
2 changed files with 3 additions and 3 deletions

View File

@ -34,7 +34,7 @@ impl<const B: usize> BaseSumGate<B> {
pub fn new_from_config<F: Field64>(config: &CircuitConfig) -> Self {
let num_limbs =
log_floor(F::ORDER as usize - 1, B).min(config.num_routed_wires - Self::START_LIMBS);
log_floor(F::ORDER - 1, B as u64).min(config.num_routed_wires - Self::START_LIMBS);
Self::new(num_limbs)
}

View File

@ -39,11 +39,11 @@ pub fn log2_strict(n: usize) -> usize {
}
/// Returns the largest integer `i` such that `base**i <= n`.
pub const fn log_floor(n: usize, base: usize) -> usize {
pub const fn log_floor(n: u64, base: u64) -> usize {
assert!(n > 0);
assert!(base > 1);
let mut i = 0;
let mut cur: usize = 1;
let mut cur: u64 = 1;
loop {
let (mul, overflow) = cur.overflowing_mul(base);
if overflow || mul > n {