[Mesa-dev] [prefix=PATCH v3 2/3] util: Move ALIGN from mesa/main/macros.h to util/macros.h

Jason Ekstrand jason at jlekstrand.net
Wed Oct 29 17:25:51 PDT 2014


---
 src/mesa/main/bitset.h |  1 +
 src/mesa/main/macros.h | 27 ---------------------------
 src/util/macros.h      | 27 +++++++++++++++++++++++++++
 3 files changed, 28 insertions(+), 27 deletions(-)

diff --git a/src/mesa/main/bitset.h b/src/mesa/main/bitset.h
index f50b14f..dbf1af9 100644
--- a/src/mesa/main/bitset.h
+++ b/src/mesa/main/bitset.h
@@ -33,6 +33,7 @@
 
 #include "imports.h"
 #include "util/bitcount.h"
+#include "util/macros.h"
 
 /****************************************************************************
  * generic bitset implementation
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index cd5f2d6..33cc583 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -702,33 +702,6 @@ 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
- * will be rounded up.
- *
- * \param value  Value to be rounded
- * \param alignment  Alignment value to be used.  This must be a power of two.
- *
- * \sa ROUND_DOWN_TO()
- */
-#define ALIGN(value, alignment)  (((value) + (alignment) - 1) & ~((alignment) - 1))
-
-/**
- * Align a value down to an alignment value
- *
- * If \c value is not already aligned to the requested alignment value, it
- * will be rounded down.
- *
- * \param value  Value to be rounded
- * \param alignment  Alignment value to be used.  This must be a power of two.
- *
- * \sa ALIGN()
- */
-#define ROUND_DOWN_TO(value, alignment) ((value) & ~(alignment - 1))
-
-
 /** Cross product of two 3-element vectors */
 static inline void
 CROSS3(GLfloat n[3], const GLfloat u[3], const GLfloat v[3])
diff --git a/src/util/macros.h b/src/util/macros.h
index ff37a7d..1b750b6 100644
--- a/src/util/macros.h
+++ b/src/util/macros.h
@@ -31,6 +31,33 @@
 
 
 /**
+ * Align a value up to an alignment value
+ *
+ * If \c value is not already aligned to the requested alignment value, it
+ * will be rounded up.
+ *
+ * \param value  Value to be rounded
+ * \param alignment  Alignment value to be used.  This must be a power of two.
+ *
+ * \sa ROUND_DOWN_TO()
+ */
+#define ALIGN(value, alignment)  (((value) + (alignment) - 1) & ~((alignment) - 1))
+
+/**
+ * Align a value down to an alignment value
+ *
+ * If \c value is not already aligned to the requested alignment value, it
+ * will be rounded down.
+ *
+ * \param value  Value to be rounded
+ * \param alignment  Alignment value to be used.  This must be a power of two.
+ *
+ * \sa ALIGN()
+ */
+#define ROUND_DOWN_TO(value, alignment) ((value) & ~(alignment - 1))
+
+
+/**
  * __builtin_expect macros
  */
 #if !defined(HAVE___BUILTIN_EXPECT)
-- 
2.1.0



More information about the mesa-dev mailing list