Lines Matching +full:0 +full:- +full:31

1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
23 * This is a pure count, so (1-32) or (0-31) doesn't apply
24 * It could be 0 to 32, based on num of 0's in there
25 * clz(0x8000_0000) = 0, clz(0xFFFF_FFFF)=0, clz(0) = 32, clz(1) = 31
32 " norm.f %0, %1 \n" in clz()
33 " mov.n %0, 0 \n" in clz()
34 " add.p %0, %0, 1 \n" in clz()
47 return 0; in constant_fls()
48 if (!(x & 0xffff0000u)) { in constant_fls()
50 r -= 16; in constant_fls()
52 if (!(x & 0xff000000u)) { in constant_fls()
54 r -= 8; in constant_fls()
56 if (!(x & 0xf0000000u)) { in constant_fls()
58 r -= 4; in constant_fls()
60 if (!(x & 0xc0000000u)) { in constant_fls()
62 r -= 2; in constant_fls()
64 if (!(x & 0x80000000u)) in constant_fls()
65 r -= 1; in constant_fls()
71 * @result: [1-32]
72 * fls(1) = 1, fls(0x80000000) = 32, fls(0) = 0
79 return 32 - clz(x); in fls()
83 * __fls: Similar to fls, but zero based (0-31)
88 return 0; in __fls()
90 return fls(x) - 1; in __fls()
95 * @result: [1-32], 0 if all 0's
97 #define ffs(x) ({ unsigned long __t = (x); fls(__t & -__t); })
100 * __ffs: Similar to ffs, but zero based (0-31)
107 return ffs(word) - 1; in __ffs()
114 * @result: [1-32]
115 * fls(1) = 1, fls(0x80000000) = 32, fls(0) = 0
122 " fls.f %0, %1 \n" /* 0:31; 0(Z) if src 0 */ in fls()
123 " add.nz %0, %0, 1 \n" /* 0:31 -> 1:32 */ in fls()
132 * __fls: Similar to fls, but zero based (0-31). Also 0 if no bit set
142 * @result: [1-32], 0 if all 0's
149 " ffs.f %0, %1 \n" /* 0:31; 31(Z) if src 0 */ in ffs()
150 " add.nz %0, %0, 1 \n" /* 0:31 -> 1:32 */ in ffs()
151 " mov.z %0, 0 \n" /* 31(Z)-> 0 */ in ffs()
160 * __ffs: Similar to ffs, but zero based (0-31)
167 " ffs.f %0, %1 \n" /* 0:31; 31(Z) if src 0 */ in __ffs()
168 " mov.z %0, 0 \n" /* 31(Z)-> 0 */ in __ffs()
181 * @return:[0-31], 32 if all 1's
185 #include <asm-generic/bitops/hweight.h>
186 #include <asm-generic/bitops/fls64.h>
187 #include <asm-generic/bitops/sched.h>
188 #include <asm-generic/bitops/lock.h>
189 #include <asm-generic/bitops/atomic.h>
190 #include <asm-generic/bitops/non-atomic.h>
192 #include <asm-generic/bitops/le.h>
193 #include <asm-generic/bitops/ext2-atomic-setbit.h>