Export bigint helpers, name columns with hex

This commit is contained in:
Dhole
2023-09-18 22:43:25 +02:00
parent 89575759d2
commit 89dbd86373
2 changed files with 7 additions and 7 deletions

View File

@@ -213,7 +213,7 @@ impl<V: Var> Analysis<V> {
}
}
pub(crate) fn to_biguint(c: BigInt, p: &BigUint) -> BigUint {
pub fn to_biguint(c: BigInt, p: &BigUint) -> BigUint {
let (sign, c) = c.into_parts();
if sign == Sign::Minus {
p - c
@@ -222,7 +222,7 @@ pub(crate) fn to_biguint(c: BigInt, p: &BigUint) -> BigUint {
}
}
pub(crate) fn to_bigint(c: &BigUint, p: &BigUint, max_bits: u64) -> BigInt {
pub fn to_bigint(c: &BigUint, p: &BigUint, max_bits: u64) -> BigInt {
let neg = p - c;
if neg.bits() <= max_bits {
-neg.to_bigint().expect("BigUint to BigInt")

View File

@@ -608,28 +608,28 @@ pub fn get_plaf<F: Field + PrimeField<Repr = [u8; 32]>, ConcreteCircuit: Circuit
for i in 0..cs.num_fixed_columns() {
let name = if i < num_fixed_columns_orig {
format!("f{:02}", i)
format!("f{:02x}", i)
} else {
// This should only happen when `compress_selectors = true`, otherwise
// `num_fixed_columns_orig == cs.num_fixed_columns()`
format!("s{:02}", i - num_fixed_columns_orig)
format!("s{:02x}", i - num_fixed_columns_orig)
};
plaf.columns.fixed.push(ColumnFixed::new(name));
}
// If `compress_selectors = true`, then there should be 0 selectors in `cs`.
for i in 0..cs.num_selectors() {
let name = format!("s{:02}", i);
let name = format!("s{:02x}", i);
plaf.columns.fixed.push(ColumnFixed::new(name));
}
for i in 0..cs.num_instance_columns() {
plaf.columns
.public
.push(ColumnPublic::new(format!("i{:02}", i)));
.push(ColumnPublic::new(format!("i{:02x}", i)));
}
let column_phase = cs.advice_column_phase();
for i in 0..cs.num_advice_columns() {
plaf.columns.witness.push(ColumnWitness::new(
format!("w{:02}", i),
format!("w{:02x}", i),
column_phase[i] as usize,
));
}