Skip to content

Commit

Permalink
add bitSize option to getMontgomeryCoeff
Browse files Browse the repository at this point in the history
  • Loading branch information
herumi committed Feb 29, 2024
1 parent 90742e6 commit 8946e74
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/mcl/bint.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -460,12 +460,12 @@ MCL_DLL_API void sqr_SECP256K1(Unit *y, const Unit *x, const Unit *p);
MCL_DLL_API void maskN(Unit *x, size_t n, size_t bitSize);

// ppLow = Unit(p)
inline Unit getMontgomeryCoeff(Unit pLow)
inline Unit getMontgomeryCoeff(Unit pLow, size_t bitSize = sizeof(Unit) * 8)
{
Unit pp = 0;
Unit t = 0;
Unit x = 1;
for (size_t i = 0; i < sizeof(Unit) * 8; i++) {
for (size_t i = 0; i < bitSize; i++) {
if ((t & 1) == 0) {
t += pLow;
pp += x;
Expand Down

0 comments on commit 8946e74

Please sign in to comment.