mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-11 18:23:09 +00:00
use map; and TODOs
This commit is contained in:
parent
1d4bb3950d
commit
e838096940
@ -206,6 +206,7 @@ pub trait Field:
|
||||
subgroup.into_iter().map(|x| x * shift).collect()
|
||||
}
|
||||
|
||||
// TODO: move these to a new `PrimeField` trait (for all prime fields, not just 64-bit ones)
|
||||
fn from_biguint(n: BigUint) -> Self;
|
||||
|
||||
fn to_biguint(&self) -> BigUint;
|
||||
|
||||
@ -28,12 +28,10 @@ impl BigUintTarget {
|
||||
impl<F: RichField + Extendable<D>, const D: usize> CircuitBuilder<F, D> {
|
||||
pub fn constant_biguint(&mut self, value: &BigUint) -> BigUintTarget {
|
||||
let limb_values = value.to_u32_digits();
|
||||
let mut limbs = Vec::new();
|
||||
for i in 0..limb_values.len() {
|
||||
limbs.push(U32Target(
|
||||
self.constant(F::from_canonical_u32(limb_values[i])),
|
||||
));
|
||||
}
|
||||
let limbs = limb_values
|
||||
.iter()
|
||||
.map(|l| self.constant(F::from_canonical_u32(l)))
|
||||
.collect();
|
||||
|
||||
BigUintTarget { limbs }
|
||||
}
|
||||
|
||||
@ -13,6 +13,8 @@ use crate::plonk::plonk_common::{reduce_with_powers, reduce_with_powers_ext_recu
|
||||
use crate::plonk::vars::{EvaluationTargets, EvaluationVars, EvaluationVarsBase};
|
||||
use crate::util::{bits_u64, ceil_div_usize};
|
||||
|
||||
// TODO: replace/merge this gate with `ComparisonGate`.
|
||||
|
||||
/// A gate for checking that one value is less than or equal to another.
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct AssertLessThanGate<F: PrimeField + Extendable<D>, const D: usize> {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user