mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-02 13:53:07 +00:00
Feedback
This commit is contained in:
parent
2a37aeca5d
commit
0aecc2a3cf
@ -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, B).min(config.num_routed_wires - Self::START_LIMBS);
|
||||
log_floor(F::ORDER as usize - 1, B).min(config.num_routed_wires - Self::START_LIMBS);
|
||||
Self::new(num_limbs)
|
||||
}
|
||||
|
||||
|
||||
@ -38,7 +38,7 @@ pub fn log2_strict(n: usize) -> usize {
|
||||
res as usize
|
||||
}
|
||||
|
||||
/// Returns the largest `i` such that `base**i < n`.
|
||||
/// Returns the largest integer `i` such that `base**i <= n`.
|
||||
pub const fn log_floor(n: usize, base: usize) -> usize {
|
||||
assert!(n > 0);
|
||||
assert!(base > 1);
|
||||
@ -46,7 +46,7 @@ pub const fn log_floor(n: usize, base: usize) -> usize {
|
||||
let mut cur: usize = 1;
|
||||
loop {
|
||||
let (mul, overflow) = cur.overflowing_mul(base);
|
||||
if overflow || mul >= n {
|
||||
if overflow || mul > n {
|
||||
return i;
|
||||
} else {
|
||||
i += 1;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user