7#ifndef SECP256K1_MODINV64_IMPL_H
8#define SECP256K1_MODINV64_IMPL_H
37 for (i = 0; i < 4; ++i) {
52 for (i = 0; i < 4; ++i) {
57 for (i = 4; i >= 0; --i) {
58 if (
am.v[i] <
bm.v[i])
return -1;
59 if (
am.v[i] >
bm.v[i])
return 1;
77 for (i = 0; i < 5; ++i) {
165 uint64_t u = 1, v = 0, q = 0, r = 1;
169 for (i = 0; i < 62; ++i) {
224 uint64_t u = 1, v = 0, q = 0, r = 1;
250 tmp =
f;
f =
g;
g = -tmp;
251 tmp = u; u = q; q = -tmp;
252 tmp = v; v = r; r = -tmp;
262 w = (
f *
g * (
f *
f - 2)) & m;
272 w =
f + (((
f + 1) & 4) << 1);
304 const int64_t u =
t->u, v =
t->v, q =
t->q, r =
t->r;
321 me = (q &
sd) + (r &
se);
387 const int64_t u =
t->u, v =
t->v, q =
t->q, r =
t->r;
428 const int64_t u =
t->u, v =
t->v, q =
t->q, r =
t->r;
443 for (i = 1; i <
len; ++i) {
467 for (i = 0; i < 12; ++i) {
542 for (
j = 1;
j <
len; ++
j) {
546 if (cond == 0)
break;
553 cond |= fn ^ (fn >> 63);
554 cond |=
gn ^ (
gn >> 63);
static int64_t secp256k1_modinv64_divsteps_62_var(int64_t eta, uint64_t f0, uint64_t g0, secp256k1_modinv64_trans2x2 *t)
static void secp256k1_modinv64_normalize_62(secp256k1_modinv64_signed62 *r, int64_t sign, const secp256k1_modinv64_modinfo *modinfo)
static void secp256k1_modinv64(secp256k1_modinv64_signed62 *x, const secp256k1_modinv64_modinfo *modinfo)
static void secp256k1_modinv64_var(secp256k1_modinv64_signed62 *x, const secp256k1_modinv64_modinfo *modinfo)
static void secp256k1_modinv64_update_fg_62_var(int len, secp256k1_modinv64_signed62 *f, secp256k1_modinv64_signed62 *g, const secp256k1_modinv64_trans2x2 *t)
static void secp256k1_modinv64_update_fg_62(secp256k1_modinv64_signed62 *f, secp256k1_modinv64_signed62 *g, const secp256k1_modinv64_trans2x2 *t)
static int64_t secp256k1_modinv64_divsteps_62(int64_t eta, uint64_t f0, uint64_t g0, secp256k1_modinv64_trans2x2 *t)
static void secp256k1_modinv64_update_de_62(secp256k1_modinv64_signed62 *d, secp256k1_modinv64_signed62 *e, const secp256k1_modinv64_trans2x2 *t, const secp256k1_modinv64_modinfo *modinfo)
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
static SECP256K1_INLINE int secp256k1_ctz64_var(uint64_t x)
#define VERIFY_CHECK(cond)