aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib/math/numbertheory/reducer.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/math/numbertheory/reducer.cpp b/src/lib/math/numbertheory/reducer.cpp
index e9db7753b..9dbcfb9a3 100644
--- a/src/lib/math/numbertheory/reducer.cpp
+++ b/src/lib/math/numbertheory/reducer.cpp
@@ -62,10 +62,10 @@ BigInt Modular_Reducer::reduce(const BigInt& x) const
t1.reduce_below(m_modulus, ws);
- if(x.is_positive())
- return t1;
- else
- return (m_modulus - t1);
+ if(x.is_negative())
+ t1.rev_sub(m_modulus.data(), m_modulus.size(), ws);
+
+ return t1;
}
else
{