From d2c589e281faf2a9b760c0ffe7aaadba6a15bc58 Mon Sep 17 00:00:00 2001 From: Nicholas Ward Date: Wed, 6 Oct 2021 11:42:34 -0700 Subject: [PATCH] addressed comments --- src/field/secp256k1.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/field/secp256k1.rs b/src/field/secp256k1.rs index fb48dba0..049334fc 100644 --- a/src/field/secp256k1.rs +++ b/src/field/secp256k1.rs @@ -38,7 +38,11 @@ fn biguint_from_array(arr: [u64; 4]) -> BigUint { impl Secp256K1Base { fn to_canonical_biguint(&self) -> BigUint { - biguint_from_array(self.0).mod_floor(&Self::order()) + let mut result = biguint_from_array(self.0); + if result > Self::order() { + result -= Self::order(); + } + result } fn from_biguint(val: BigUint) -> Self { @@ -162,7 +166,6 @@ impl Add for Secp256K1Base { type Output = Self; #[inline] - fn add(self, rhs: Self) -> Self { let mut result = self.to_canonical_biguint() + rhs.to_canonical_biguint(); if result >= Self::order() {