Skip to content

Commit 5072b1c

Browse files
committed
crypto: ecc - Silence sparse warning
Rewrite the bitwise operations to silence the sparse warnings: CHECK ../crypto/ecc.c ../crypto/ecc.c:1387:39: warning: dubious: !x | y ../crypto/ecc.c:1397:47: warning: dubious: !x | y Signed-off-by: Herbert Xu <[email protected]> Reviewed-by: Vitaly Chikunov <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent d3777ce commit 5072b1c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

crypto/ecc.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,7 +1384,8 @@ void ecc_point_mult_shamir(const struct ecc_point *result,
13841384

13851385
num_bits = max(vli_num_bits(u1, ndigits), vli_num_bits(u2, ndigits));
13861386
i = num_bits - 1;
1387-
idx = (!!vli_test_bit(u1, i)) | ((!!vli_test_bit(u2, i)) << 1);
1387+
idx = !!vli_test_bit(u1, i);
1388+
idx |= (!!vli_test_bit(u2, i)) << 1;
13881389
point = points[idx];
13891390

13901391
vli_set(rx, point->x, ndigits);
@@ -1394,7 +1395,8 @@ void ecc_point_mult_shamir(const struct ecc_point *result,
13941395

13951396
for (--i; i >= 0; i--) {
13961397
ecc_point_double_jacobian(rx, ry, z, curve);
1397-
idx = (!!vli_test_bit(u1, i)) | ((!!vli_test_bit(u2, i)) << 1);
1398+
idx = !!vli_test_bit(u1, i);
1399+
idx |= (!!vli_test_bit(u2, i)) << 1;
13981400
point = points[idx];
13991401
if (point) {
14001402
u64 tx[ECC_MAX_DIGITS];

0 commit comments

Comments
 (0)