diff options
author | Kenneth Graunke <[email protected]> | 2014-04-06 17:29:48 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2014-04-08 00:01:51 -0700 |
commit | bd69f65f90ecfa45e43a72504d277cb39f00e1c1 (patch) | |
tree | 59461815405bedf50196ba55f0fc4546711d5887 /src/mesa/main | |
parent | 6bda3a526759f655cad62178b491264584119ae1 (diff) |
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 <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/macros.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h index dafeaa372f1..5228c3a8f28 100644 --- a/src/mesa/main/macros.h +++ b/src/mesa/main/macros.h @@ -685,6 +685,17 @@ minify(unsigned value, unsigned 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 * * If \c value is not already aligned to the requested alignment value, it |