mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-07 16:23:12 +00:00
Use u64 instead of usize
This commit is contained in:
parent
0aecc2a3cf
commit
ee54b295d9
@ -34,7 +34,7 @@ impl<const B: usize> BaseSumGate<B> {
|
|||||||
|
|
||||||
pub fn new_from_config<F: Field64>(config: &CircuitConfig) -> Self {
|
pub fn new_from_config<F: Field64>(config: &CircuitConfig) -> Self {
|
||||||
let num_limbs =
|
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)
|
Self::new(num_limbs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -39,11 +39,11 @@ pub fn log2_strict(n: usize) -> usize {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Returns the largest integer `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 {
|
pub const fn log_floor(n: u64, base: u64) -> usize {
|
||||||
assert!(n > 0);
|
assert!(n > 0);
|
||||||
assert!(base > 1);
|
assert!(base > 1);
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
let mut cur: usize = 1;
|
let mut cur: u64 = 1;
|
||||||
loop {
|
loop {
|
||||||
let (mul, overflow) = cur.overflowing_mul(base);
|
let (mul, overflow) = cur.overflowing_mul(base);
|
||||||
if overflow || mul > n {
|
if overflow || mul > n {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user