Skip to content

Commit df135b4

Browse files
committed
Move secp256k1_scalar_is_even to make things clearer
1 parent 42edc33 commit df135b4

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/scalar_impl.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ static void secp256k1_scalar_inverse(secp256k1_scalar *r, const secp256k1_scalar
6767
/* If this VERIFY_CHECK triggers we were given a noninvertible scalar (and thus
6868
* have a composite group order; fix it in exhaustive_tests.c). */
6969
VERIFY_CHECK(*r != 0);
70-
}
7170
#else
7271
secp256k1_scalar *t;
7372
int i;
@@ -220,12 +219,8 @@ static void secp256k1_scalar_inverse(secp256k1_scalar *r, const secp256k1_scalar
220219
secp256k1_scalar_sqr(t, t);
221220
}
222221
secp256k1_scalar_mul(r, t, &x6); /* 111111 */
223-
}
224-
225-
SECP256K1_INLINE static int secp256k1_scalar_is_even(const secp256k1_scalar *a) {
226-
return !(a->d[0] & 1);
227-
}
228222
#endif
223+
}
229224

230225
static void secp256k1_scalar_pow2_div(secp256k1_scalar *r, const secp256k1_scalar *a, int k) {
231226
static const secp256k1_scalar lookup[15] = {
@@ -326,6 +321,12 @@ static void secp256k1_scalar_inverse_var(secp256k1_scalar *r, const secp256k1_sc
326321
#endif
327322
}
328323

324+
#if !defined(EXHAUSTIVE_TEST_ORDER)
325+
SECP256K1_INLINE static int secp256k1_scalar_is_even(const secp256k1_scalar *a) {
326+
return !(a->d[0] & 1);
327+
}
328+
#endif
329+
329330
#ifdef USE_ENDOMORPHISM
330331
#if defined(EXHAUSTIVE_TEST_ORDER)
331332
/**

0 commit comments

Comments
 (0)