Re: [Mesa-dev] [PATCH 4/6] util: move min/max/clamp macros to util macros.h

2016-10-17 Thread Nicolai Hähnle

Apart from the comment I sent on the first patch, patch 1&4 are

Reviewed-by: Nicolai Hähnle 

On 14.10.2016 05:16, Dave Airlie wrote:

From: Dave Airlie 

Although the vulkan drivers include mesa macros.h, for
radv I'd like to move away from that.

Signed-off-by: Dave Airlie 
---
 src/mesa/main/macros.h | 13 -
 src/util/macros.h  | 13 +
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index ed207d4..03a228b 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -660,19 +660,6 @@ INTERP_4F(GLfloat t, GLfloat dst[4], const GLfloat out[4], 
const GLfloat in[4])



-/** Clamp X to [MIN,MAX] */
-#define CLAMP( X, MIN, MAX )  ( (X)<(MIN) ? (MIN) : ((X)>(MAX) ? (MAX) : (X)) )
-
-/** Minimum of two values: */
-#define MIN2( A, B )   ( (A)<(B) ? (A) : (B) )
-
-/** Maximum of two values: */
-#define MAX2( A, B )   ( (A)>(B) ? (A) : (B) )
-
-/** Minimum and maximum of three values: */
-#define MIN3( A, B, C ) ((A) < (B) ? MIN2(A, C) : MIN2(B, C))
-#define MAX3( A, B, C ) ((A) > (B) ? MAX2(A, C) : MAX2(B, C))
-
 static inline unsigned
 minify(unsigned value, unsigned levels)
 {
diff --git a/src/util/macros.h b/src/util/macros.h
index 9dea2a0..27d1b62 100644
--- a/src/util/macros.h
+++ b/src/util/macros.h
@@ -229,4 +229,17 @@ do {   \
 /** Compute ceiling of integer quotient of A divided by B. */
 #define DIV_ROUND_UP( A, B )  ( (A) % (B) == 0 ? (A)/(B) : (A)/(B)+1 )

+/** Clamp X to [MIN,MAX] */
+#define CLAMP( X, MIN, MAX )  ( (X)<(MIN) ? (MIN) : ((X)>(MAX) ? (MAX) : (X)) )
+
+/** Minimum of two values: */
+#define MIN2( A, B )   ( (A)<(B) ? (A) : (B) )
+
+/** Maximum of two values: */
+#define MAX2( A, B )   ( (A)>(B) ? (A) : (B) )
+
+/** Minimum and maximum of three values: */
+#define MIN3( A, B, C ) ((A) < (B) ? MIN2(A, C) : MIN2(B, C))
+#define MAX3( A, B, C ) ((A) > (B) ? MAX2(A, C) : MAX2(B, C))
+
 #endif /* UTIL_MACROS_H */


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 4/6] util: move min/max/clamp macros to util macros.h

2016-10-13 Thread Dave Airlie
From: Dave Airlie 

Although the vulkan drivers include mesa macros.h, for
radv I'd like to move away from that.

Signed-off-by: Dave Airlie 
---
 src/mesa/main/macros.h | 13 -
 src/util/macros.h  | 13 +
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index ed207d4..03a228b 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -660,19 +660,6 @@ INTERP_4F(GLfloat t, GLfloat dst[4], const GLfloat out[4], 
const GLfloat in[4])
 
 
 
-/** Clamp X to [MIN,MAX] */
-#define CLAMP( X, MIN, MAX )  ( (X)<(MIN) ? (MIN) : ((X)>(MAX) ? (MAX) : (X)) )
-
-/** Minimum of two values: */
-#define MIN2( A, B )   ( (A)<(B) ? (A) : (B) )
-
-/** Maximum of two values: */
-#define MAX2( A, B )   ( (A)>(B) ? (A) : (B) )
-
-/** Minimum and maximum of three values: */
-#define MIN3( A, B, C ) ((A) < (B) ? MIN2(A, C) : MIN2(B, C))
-#define MAX3( A, B, C ) ((A) > (B) ? MAX2(A, C) : MAX2(B, C))
-
 static inline unsigned
 minify(unsigned value, unsigned levels)
 {
diff --git a/src/util/macros.h b/src/util/macros.h
index 9dea2a0..27d1b62 100644
--- a/src/util/macros.h
+++ b/src/util/macros.h
@@ -229,4 +229,17 @@ do {   \
 /** Compute ceiling of integer quotient of A divided by B. */
 #define DIV_ROUND_UP( A, B )  ( (A) % (B) == 0 ? (A)/(B) : (A)/(B)+1 )
 
+/** Clamp X to [MIN,MAX] */
+#define CLAMP( X, MIN, MAX )  ( (X)<(MIN) ? (MIN) : ((X)>(MAX) ? (MAX) : (X)) )
+
+/** Minimum of two values: */
+#define MIN2( A, B )   ( (A)<(B) ? (A) : (B) )
+
+/** Maximum of two values: */
+#define MAX2( A, B )   ( (A)>(B) ? (A) : (B) )
+
+/** Minimum and maximum of three values: */
+#define MIN3( A, B, C ) ((A) < (B) ? MIN2(A, C) : MIN2(B, C))
+#define MAX3( A, B, C ) ((A) > (B) ? MAX2(A, C) : MAX2(B, C))
+
 #endif /* UTIL_MACROS_H */
-- 
2.5.5

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev