Skip to content

Commit 16d1322

Browse files
author
MarcoFalke
committed
refactor: Use (int)&(int) in boolean context to avoid compiler warning
This fixes a compiler warning: ./src/ecdsa_impl.h:312:12: warning: use of bitwise '&' with boolean operands [-Wbitwise-instead-of-logical] return !secp256k1_scalar_is_zero(sigr) & !secp256k1_scalar_is_zero(sigs); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 parent 515a5db commit 16d1322

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ecdsa_impl.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -304,12 +304,12 @@ static int secp256k1_ecdsa_sig_sign(const secp256k1_ecmult_gen_context *ctx, sec
304304
high = secp256k1_scalar_is_high(sigs);
305305
secp256k1_scalar_cond_negate(sigs, high);
306306
if (recid) {
307-
*recid ^= high;
307+
*recid ^= high;
308308
}
309309
/* P.x = order is on the curve, so technically sig->r could end up being zero, which would be an invalid signature.
310310
* This is cryptographically unreachable as hitting it requires finding the discrete log of P.x = N.
311311
*/
312-
return !secp256k1_scalar_is_zero(sigr) & !secp256k1_scalar_is_zero(sigs);
312+
return (int)(!secp256k1_scalar_is_zero(sigr)) & (int)(!secp256k1_scalar_is_zero(sigs));
313313
}
314314

315315
#endif /* SECP256K1_ECDSA_IMPL_H */

0 commit comments

Comments
 (0)