This was suggested by Peter Dettman, results in a 1.7% speedup (when compiled with --field=64bit --enable-endomorphism CFLAGS=-O3), and could simplify assembly implementations.
Enforce and use r != b for field multiplication #124
pull sipa wants to merge 2 commits into bitcoin-core:master from sipa:restrictb changing 9 files +69 −63-
sipa commented at 6:46 PM on November 30, 2014: contributor
- sipa force-pushed on Nov 30, 2014
- sipa force-pushed on Nov 30, 2014
-
sipa commented at 8:41 PM on November 30, 2014: contributor
@gmaxwell Moved the SECP256K1_RESTRICT macro to util.h (I don't think we should be using it in the external interface anyway), and made it into a dummy if building with VERIFY.
I did catch errors with the code as it was, though, so GCC isn't smart enough to compile a "if (r != b)" check away, even with a restrict on b.
-
be82e92fc4
Require that r and b are different for field multiplication.
Suggested by Peter Dettman, this prepares for slightly faster muitiplication which writes results immediately to r before finishing reading b.
-
4d4eeea4ac
Make secp256k1_fe_mul_inner use the r != property
Suggested by Peter Dettman.
- sipa force-pushed on Dec 1, 2014
-
gmaxwell commented at 2:27 PM on December 2, 2014: contributor
ACK
- sipa merged this on Dec 2, 2014
- sipa closed this on Dec 2, 2014
- sipa referenced this in commit 276f987d70 on Dec 2, 2014