Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

lib: crypto: fix comments for count_leading_zeros()

count_leading_zeros() is based on fls(), which is defined for x == 0,
contrary to __ffs() family. The comment in crypto/mpi erroneously
states that the function may return undef in such case.

Fix the comment together with the outdated function signature, and now
that COUNT_LEADING_ZEROS_0 is not referenced in the codebase, get rid of
it too.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Yury Norov <ynorov@nvidia.com>

+5 -7
+1 -3
include/linux/count_zeros.h
··· 18 18 * 19 19 * If the MSB of @x is set, the result is 0. 20 20 * If only the LSB of @x is set, then the result is BITS_PER_LONG-1. 21 - * If @x is 0 then the result is COUNT_LEADING_ZEROS_0. 21 + * If @x is 0 then the result is BITS_PER_LONG. 22 22 */ 23 23 static inline int count_leading_zeros(unsigned long x) 24 24 { ··· 27 27 else 28 28 return BITS_PER_LONG - fls64(x); 29 29 } 30 - 31 - #define COUNT_LEADING_ZEROS_0 BITS_PER_LONG 32 30 33 31 /** 34 32 * count_trailing_zeros - Count the number of zeros from the LSB forwards
+4 -4
lib/crypto/mpi/longlong.h
··· 66 66 * denominator). Like udiv_qrnnd but the numbers are signed. The quotient 67 67 * is rounded towards 0. 68 68 * 69 - * 5) count_leading_zeros(count, x) counts the number of zero-bits from the 69 + * 5) count_leading_zeros(x) counts the number of zero-bits from the 70 70 * msb to the first non-zero bit in the UWtype X. This is the number of 71 - * steps X needs to be shifted left to set the msb. Undefined for X == 0, 72 - * unless the symbol COUNT_LEADING_ZEROS_0 is defined to some value. 71 + * steps X needs to be shifted left to set the msb. 72 + * count_leading_zeros(0) == BITS_PER_LONG 73 73 * 74 - * 6) count_trailing_zeros(count, x) like count_leading_zeros, but counts 74 + * 6) count_trailing_zeros() like count_leading_zeros(), but counts 75 75 * from the least significant end. 76 76 * 77 77 * 7) add_ssaaaa(high_sum, low_sum, high_addend_1, low_addend_1,