Merge commit 'origin/master' into gallium-0.2
[mesa.git] / src / mesa / main / imports.h
index 0e6e301fdeb6291625ab143d286fe1046ed93a47..bab00420710668f838c1fde072310a8ba2eadd22 100644 (file)
@@ -462,6 +462,16 @@ static INLINE int iceil(float f)
 #endif
 
 
+/**
+ * Is x a power of two?
+ */
+static INLINE int
+_mesa_is_pow_two(int x)
+{
+   return !(x & (x - 1));
+}
+
+
 /***
  *** UNCLAMPED_FLOAT_TO_UBYTE: clamp float to [0,1] and map to ubyte in [0,255]
  *** CLAMPED_FLOAT_TO_UBYTE: map float known to be in [0,1] to ubyte in [0,255]