util/u_math: Implement a logbase2 function for unsigned long
v2 (Karol Herbst <kherbst@redhat.com>): * removed unneeded ll * ll -> ull Signed-off-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Eric Engestrom <eric.engestrom@intel.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
This commit is contained in:
committed by
Karol Herbst
parent
539aa604a0
commit
03f592a164
@@ -123,6 +123,17 @@ util_is_power_of_two_or_zero(unsigned v)
|
||||
return (v & (v - 1)) == 0;
|
||||
}
|
||||
|
||||
/* Determine if an uint64_t value is a power of two.
|
||||
*
|
||||
* \note
|
||||
* Zero is treated as a power of two.
|
||||
*/
|
||||
static inline bool
|
||||
util_is_power_of_two_or_zero64(uint64_t v)
|
||||
{
|
||||
return (v & (v - 1)) == 0;
|
||||
}
|
||||
|
||||
/* Determine if an unsigned value is a power of two.
|
||||
*
|
||||
* \note
|
||||
|
||||
Reference in New Issue
Block a user