aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mpi/mpi-bit.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2012-09-13 08:09:33 -0400
committerRusty Russell <rusty@rustcorp.com.au>2012-10-07 23:20:11 -0400
commitaacf29bf1bf133f6219e6f8969d4ebc2ac76458f (patch)
treeb4379ab6617d1e963020365e03cda0b551bc3237 /lib/mpi/mpi-bit.c
parentcf7f601c067994f371ba77721d1e45fce61a4569 (diff)
MPILIB: Provide count_leading/trailing_zeros() based on arch functions
Provide count_leading/trailing_zeros() macros based on extant arch bit scanning functions rather than reimplementing from scratch in MPILIB. Whilst we're at it, turn count_foo_zeros(n, x) into n = count_foo_zeros(x). Also move the definition to asm-generic as other people may be interested in using it. Signed-off-by: David Howells <dhowells@redhat.com> Cc: David S. Miller <davem@davemloft.net> Cc: Dmitry Kasatkin <dmitry.kasatkin@intel.com> Cc: Arnd Bergmann <arnd@arndb.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib/mpi/mpi-bit.c')
-rw-r--r--lib/mpi/mpi-bit.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/mpi/mpi-bit.c b/lib/mpi/mpi-bit.c
index 568724804f29..503537e08436 100644
--- a/lib/mpi/mpi-bit.c
+++ b/lib/mpi/mpi-bit.c
@@ -45,7 +45,7 @@ unsigned mpi_get_nbits(MPI a)
45 if (a->nlimbs) { 45 if (a->nlimbs) {
46 mpi_limb_t alimb = a->d[a->nlimbs - 1]; 46 mpi_limb_t alimb = a->d[a->nlimbs - 1];
47 if (alimb) 47 if (alimb)
48 count_leading_zeros(n, alimb); 48 n = count_leading_zeros(alimb);
49 else 49 else
50 n = BITS_PER_MPI_LIMB; 50 n = BITS_PER_MPI_LIMB;
51 n = BITS_PER_MPI_LIMB - n + (a->nlimbs - 1) * BITS_PER_MPI_LIMB; 51 n = BITS_PER_MPI_LIMB - n + (a->nlimbs - 1) * BITS_PER_MPI_LIMB;