Abstract out verify logic for fe_is_zero

This commit is contained in:
Pieter Wuille
2022-01-28 18:07:55 -05:00
parent c701d9a471
commit d3f3fe8616
4 changed files with 18 additions and 11 deletions

View File

@@ -215,12 +215,8 @@ SECP256K1_INLINE static void secp256k1_fe_impl_set_int(secp256k1_fe *r, int a) {
r->n[1] = r->n[2] = r->n[3] = r->n[4] = 0;
}
SECP256K1_INLINE static int secp256k1_fe_is_zero(const secp256k1_fe *a) {
SECP256K1_INLINE static int secp256k1_fe_impl_is_zero(const secp256k1_fe *a) {
const uint64_t *t = a->n;
#ifdef VERIFY
VERIFY_CHECK(a->normalized);
secp256k1_fe_verify(a);
#endif
return (t[0] | t[1] | t[2] | t[3] | t[4]) == 0;
}