From 87d81290341e7350e26d530bc11b587fc9211440 Mon Sep 17 00:00:00 2001 From: Nicholas Ward Date: Tue, 26 Oct 2021 14:38:10 -0700 Subject: [PATCH] reduce --- src/gadgets/biguint.rs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/gadgets/biguint.rs b/src/gadgets/biguint.rs index 83ca5796..1f4ccbb5 100644 --- a/src/gadgets/biguint.rs +++ b/src/gadgets/biguint.rs @@ -26,7 +26,7 @@ impl BigUintTarget { } impl, const D: usize> CircuitBuilder { - fn constant_biguint(&mut self, value: BigUint) -> BigUintTarget { + 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() { @@ -194,6 +194,24 @@ impl, const D: usize> CircuitBuilder { (div, rem) } + + pub fn div_biguint( + &mut self, + a: BigUintTarget, + b: BigUintTarget, + ) -> BigUintTarget { + let (div, _rem) = self.div_rem_biguint(a, b); + div + } + + pub fn rem_biguint( + &mut self, + a: BigUintTarget, + b: BigUintTarget, + ) -> BigUintTarget { + let (_div, rem) = self.div_rem_biguint(a, b); + rem + } } #[derive(Debug)]