field: Simplify code in secp256k1_fe_set_b32

This commit is contained in:
Tim Ruffing 2023-02-01 11:44:28 +01:00
parent d93f62e369
commit ca92a35d01
2 changed files with 4 additions and 14 deletions

View File

@ -367,13 +367,8 @@ static int secp256k1_fe_set_b32(secp256k1_fe *r, const unsigned char *a) {
ret = !((r->n[9] == 0x3FFFFFUL) & ((r->n[8] & r->n[7] & r->n[6] & r->n[5] & r->n[4] & r->n[3] & r->n[2]) == 0x3FFFFFFUL) & ((r->n[1] + 0x40UL + ((r->n[0] + 0x3D1UL) >> 26)) > 0x3FFFFFFUL));
#ifdef VERIFY
r->magnitude = 1;
if (ret) {
r->normalized = 1;
r->normalized = ret;
secp256k1_fe_verify(r);
} else {
r->normalized = 0;
secp256k1_fe_verify(r);
}
#endif
return ret;
}

View File

@ -342,13 +342,8 @@ static int secp256k1_fe_set_b32(secp256k1_fe *r, const unsigned char *a) {
ret = !((r->n[4] == 0x0FFFFFFFFFFFFULL) & ((r->n[3] & r->n[2] & r->n[1]) == 0xFFFFFFFFFFFFFULL) & (r->n[0] >= 0xFFFFEFFFFFC2FULL));
#ifdef VERIFY
r->magnitude = 1;
if (ret) {
r->normalized = 1;
r->normalized = ret;
secp256k1_fe_verify(r);
} else {
r->normalized = 0;
secp256k1_fe_verify(r);
}
#endif
return ret;
}