mesa/st: enable carry/borrow lowering pass
[mesa.git] / src / mesa / main / macros.h
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
  *