Mesa (master): mesa: Move is_power_of_two() function from brw_context.h to macros.h.
Kenneth Graunke
kwg at kemper.freedesktop.org
Tue Apr 8 07:03:45 UTC 2014
Module: Mesa
Branch: master
Commit: bd69f65f90ecfa45e43a72504d277cb39f00e1c1
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=bd69f65f90ecfa45e43a72504d277cb39f00e1c1
Author: Kenneth Graunke <kenneth at whitecape.org>
Date: Sun Apr 6 17:29:48 2014 -0700
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 at whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Matt Turner <mattst88 at gmail.com>
---
src/mesa/drivers/dri/i965/brw_context.h | 6 ------
src/mesa/main/macros.h | 11 +++++++++++
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index dbe504a..487142c 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -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
*/
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index dafeaa3..5228c3a 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
More information about the mesa-commit
mailing list