diff options
author | lloyd <[email protected]> | 2010-03-16 00:21:30 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-03-16 00:21:30 +0000 |
commit | 4be0c32f1715ca97f6cc85bc1905899f5cd01cef (patch) | |
tree | 3f7d40f046f6c3fb12f3a23be909916a099344a3 /src/math/bigint/big_ops2.cpp | |
parent | b96139b84113b583a453c820127c4765c6f0f66f (diff) |
Add a special handler for the case of doing a subtraction as in:
x -= y;
where abs(x) < abs(y).
This change alone increases ECDSA performance by 5 to 15%
Diffstat (limited to 'src/math/bigint/big_ops2.cpp')
-rw-r--r-- | src/math/bigint/big_ops2.cpp | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/math/bigint/big_ops2.cpp b/src/math/bigint/big_ops2.cpp index 1137fe4b2..cc50c26e5 100644 --- a/src/math/bigint/big_ops2.cpp +++ b/src/math/bigint/big_ops2.cpp @@ -62,11 +62,7 @@ BigInt& BigInt::operator-=(const BigInt& y) if(relative_size < 0) { if(sign() == y.sign()) - { - SecureVector<word> z(reg_size - 1); - bigint_sub3(z, y.data(), reg_size - 1, data(), x_sw); - copy_mem(get_reg().begin(), z.begin(), z.size()); - } + bigint_sub2_rev(get_reg(), y.data(), y_sw); else bigint_add2(get_reg(), reg_size - 1, y.data(), y_sw); |