mesa/st: enable carry/borrow lowering pass
[mesa.git] / src / mesa / main / macros.h
index 379f75663875b0aad74b46c30de80f9959a5f316..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
  *
@@ -809,5 +820,7 @@ DIFFERENT_SIGNS(GLfloat x, GLfloat y)
 /* Compute the size of an array */
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
 
+/* Stringify */
+#define STRINGIFY(x) #x
 
 #endif