mesa: Move is_power_of_two() function from brw_context.h to macros.h.

This makes the function available from core Mesa code, including the
GLSL compiler.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
Kenneth Graunke 2014-04-06 17:29:48 -07:00
parent 6bda3a5267
commit bd69f65f90
2 changed files with 11 additions and 6 deletions

View File

@ -1430,12 +1430,6 @@ struct brw_context
struct intel_screen *intelScreen;
};
static inline bool
is_power_of_two(uint32_t value)
{
return (value & (value - 1)) == 0;
}
/*======================================================================
* brw_vtbl.c
*/

View File

@ -684,6 +684,17 @@ minify(unsigned value, unsigned levels)
return MAX2(1, value >> levels);
}
/**
* Return true if the given value is a power of two.
*
* Note that this considers 0 a power of two.
*/
static inline bool
is_power_of_two(unsigned value)
{
return (value & (value - 1)) == 0;
}
/**
* Align a value up to an alignment value
*