mesa: Move is_power_of_two() function from brw_context.h to macros.h.
authorKenneth Graunke <kenneth@whitecape.org>
Mon, 7 Apr 2014 00:29:48 +0000 (17:29 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Tue, 8 Apr 2014 07:01:51 +0000 (00:01 -0700)
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>
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/main/macros.h

index dbe504aab101dfa58b726ba2cce394096ad4a687..487142cd300bd5625c163f7f84a617c56578968f 100644 (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
  */
index dafeaa372f1c7ad7d6e5fbaadb787230127642a8..5228c3a8f28e798ddab8d7cd4d095d3bf9d098b6 100644 (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
  *