Page MenuHomePhabricator

[SECP256K1] Optimization: special-case zero modulus limbs in modinv64
ClosedPublic

Authored by Fabien on Apr 13 2021, 18:32.

Details

Summary
Both the field and scalar modulus can be written in signed{30,62}
notation with one or more zero limbs. Make use of this in the update_de
function to avoid a few wide multiplications when that is the case.

This doesn't appear to be a win in the 32-bit implementation, so only
do it for the 64-bit one.

Partial backport of secp256k1#831:
https://github.com/bitcoin-core/secp256k1/pull/831/commits/9164a1b6582e2fc833c760a3403d26b9b0b3b7b3

Depends on D9408.

Test Plan
ninja check-secp256k1

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable