mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 09:28:07 +02:00
util: add util_is_power_of_two function
This commit is contained in:
parent
00c8359182
commit
b1cc196e6d
1 changed files with 8 additions and 0 deletions
|
|
@ -273,6 +273,14 @@ util_fast_pow(float x, float y)
|
|||
return util_fast_exp2(util_fast_log2(x) * y);
|
||||
}
|
||||
|
||||
/* Note that this counts zero as a power of two.
|
||||
*/
|
||||
static INLINE boolean
|
||||
util_is_power_of_two( unsigned v )
|
||||
{
|
||||
return (v & (v-1)) == 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue