From d36a745ccfd3efec8a011dd1d76e34bbc3f193fb Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Thu, 1 Mar 2018 17:39:56 -0500 Subject: Tiny but useful optimization in bigint_monty_redc Increases perf of larger DH by 5-8% --- src/lib/math/mp/mp_monty.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/lib/math/mp/mp_monty.cpp b/src/lib/math/mp/mp_monty.cpp index b2b3b5e4e..e2f93a9a7 100644 --- a/src/lib/math/mp/mp_monty.cpp +++ b/src/lib/math/mp/mp_monty.cpp @@ -60,7 +60,7 @@ void bigint_monty_redc(word z[], for(size_t j = p_size + 1; j < z_size - i; ++j) { z_i[j] += carry; - carry = carry & !z_i[j]; + carry = (z_i[j] < carry); } } -- cgit v1.2.3