aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-powerpc/bitops.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-powerpc/bitops.h')
-rw-r--r--include/asm-powerpc/bitops.h32
1 files changed, 17 insertions, 15 deletions
diff --git a/include/asm-powerpc/bitops.h b/include/asm-powerpc/bitops.h
index 220d9a781ab9..a99a74929475 100644
--- a/include/asm-powerpc/bitops.h
+++ b/include/asm-powerpc/bitops.h
@@ -312,24 +312,26 @@ static __inline__ int fls(unsigned int x)
312 asm ("cntlzw %0,%1" : "=r" (lz) : "r" (x)); 312 asm ("cntlzw %0,%1" : "=r" (lz) : "r" (x));
313 return 32 - lz; 313 return 32 - lz;
314} 314}
315
316/*
317 * 64-bit can do this using one cntlzd (count leading zeroes doubleword)
318 * instruction; for 32-bit we use the generic version, which does two
319 * 32-bit fls calls.
320 */
321#ifdef __powerpc64__
322static __inline__ int fls64(__u64 x)
323{
324 int lz;
325
326 asm ("cntlzd %0,%1" : "=r" (lz) : "r" (x));
327 return 64 - lz;
328}
329#else
315#include <asm-generic/bitops/fls64.h> 330#include <asm-generic/bitops/fls64.h>
331#endif /* __powerpc64__ */
316 332
317#include <asm-generic/bitops/hweight.h> 333#include <asm-generic/bitops/hweight.h>
318 334#include <asm-generic/bitops/find.h>
319#define find_first_zero_bit(addr, size) find_next_zero_bit((addr), (size), 0)
320unsigned long find_next_zero_bit(const unsigned long *addr,
321 unsigned long size, unsigned long offset);
322/**
323 * find_first_bit - find the first set bit in a memory region
324 * @addr: The address to start the search at
325 * @size: The maximum size to search
326 *
327 * Returns the bit-number of the first set bit, not the number of the byte
328 * containing a bit.
329 */
330#define find_first_bit(addr, size) find_next_bit((addr), (size), 0)
331unsigned long find_next_bit(const unsigned long *addr,
332 unsigned long size, unsigned long offset);
333 335
334/* Little-endian versions */ 336/* Little-endian versions */
335 337