Lines Matching +full:two +full:-

1 /* SPDX-License-Identifier: GPL-2.0-or-later */
15 * non-constant log of base 2 calculators
16 * - the arch may override these in asm/bitops.h if they can be implemented
18 * - the arch is not required to handle n==0 if implementing the fallback
24 return fls(n) - 1; in __ilog2_u32()
32 return fls64(n) - 1; in __ilog2_u64()
37 * is_power_of_2() - check if a value is a power of two
40 * Determine whether some value is a power of two, where zero is
41 * *not* considered a power of two.
47 return (n != 0 && ((n & (n - 1)) == 0)); in is_power_of_2()
51 * __roundup_pow_of_two() - round up to nearest power of two
57 return 1UL << fls_long(n - 1); in __roundup_pow_of_two()
61 * __rounddown_pow_of_two() - round down to nearest power of two
67 return 1UL << (fls_long(n) - 1); in __rounddown_pow_of_two()
71 * const_ilog2 - log base 2 of 32-bit or a 64-bit constant unsigned value
144 -1)
147 * ilog2 - log base 2 of 32-bit or a 64-bit unsigned value
150 * constant-capable log of base 2 calculation
151 * - this can be used to initialise global variables from constant data, hence
154 * selects the appropriately-sized optimised version depending on sizeof(n)
160 63 - __builtin_clzll(n)) : \
167 * roundup_pow_of_two - round the given value up to nearest power of two
170 * round the given value up to the nearest power of two
171 * - the result is undefined when n == 0
172 * - this can be used to initialise global variables from constant data
178 (1UL << (ilog2((n) - 1) + 1)) \
184 * rounddown_pow_of_two - round the given value down to nearest power of two
187 * round the given value down to the nearest power of two
188 * - the result is undefined when n == 0
189 * - this can be used to initialise global variables from constant data
201 return n > 1 ? ilog2(n - 1) + 1 : 0; in __order_base_2()
205 * order_base_2 - calculate the (rounded up) base 2 order of the argument
221 ilog2((n) - 1) + 1) : \
236 * bits_per - calculate the number of bits required for the argument
239 * This is constant-capable and can be used for compile time