Re: [Mesa-dev] [PATCH 1/2] util/macros: Move DIV_ROUND_UP to util/macros.h

2015-04-27 Thread Brian Paul

On 04/26/2015 03:23 PM, Axel Davy wrote:

Move DIV_ROUND_UP to a shared location accessible everywhere

Signed-off-by: Axel Davy axel.d...@ens.fr
---
I want to use DIV_ROUND_UP in a galliumm nine patch
  src/gallium/auxiliary/util/u_math.h   | 1 -
  src/gallium/drivers/svga/include/svga3d_surfacedefs.h | 3 +--
  src/mesa/main/macros.h| 5 +
  src/util/macros.h | 2 ++
  4 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_math.h 
b/src/gallium/auxiliary/util/u_math.h
index 3d27a59..a2a2d4b 100644
--- a/src/gallium/auxiliary/util/u_math.h
+++ b/src/gallium/auxiliary/util/u_math.h
@@ -796,7 +796,6 @@ void
  util_fpstate_set(unsigned fpstate);


-
  #ifdef __cplusplus
  }
  #endif
diff --git a/src/gallium/drivers/svga/include/svga3d_surfacedefs.h 
b/src/gallium/drivers/svga/include/svga3d_surfacedefs.h
index 8763cdf..1592fec 100644
--- a/src/gallium/drivers/svga/include/svga3d_surfacedefs.h
+++ b/src/gallium/drivers/svga/include/svga3d_surfacedefs.h
@@ -30,13 +30,12 @@
   */

  #include svga3d_reg.h
+#include util/macros.h


Actually, it looks like this #include may not be needed.

We get ARRAY_SIZE via including svga3d_reg.h, which includes 
svga_types.h, which includes p_compiler.h which includes util/macros.h


Otherwise, for both:

Reviewed-by: Brian Paul bri...@vmware.com




  #ifndef ARRAY_SIZE
  #define ARRAY_SIZE(A) (sizeof(A) / sizeof(A[0]))
  #endif

-#define DIV_ROUND_UP(x, y)  (((x) + (y) - 1) / (y))
-
  #define max_t(type, x, y)  ((x)  (y) ? (x) : (y))

  /*
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index 3344ec8..0608650 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -31,6 +31,7 @@
  #ifndef MACROS_H
  #define MACROS_H

+#include util/macros.h
  #include util/u_math.h
  #include imports.h

@@ -800,10 +801,6 @@ DIFFERENT_SIGNS(GLfloat x, GLfloat y)
  }


-/** Compute ceiling of integer quotient of A divided by B. */
-#define DIV_ROUND_UP( A, B )  ( (A) % (B) == 0 ? (A)/(B) : (A)/(B)+1 )
-
-
  /** casts to silence warnings with some compilers */
  #define ENUM_TO_INT(E) ((GLint)(E))
  #define ENUM_TO_FLOAT(E)   ((GLfloat)(GLint)(E))
diff --git a/src/util/macros.h b/src/util/macros.h
index 6c7bda7..3b708ed 100644
--- a/src/util/macros.h
+++ b/src/util/macros.h
@@ -182,5 +182,7 @@ do {   \
  #define UNUSED
  #endif

+/** Compute ceiling of integer quotient of A divided by B. */
+#define DIV_ROUND_UP( A, B )  ( (A) % (B) == 0 ? (A)/(B) : (A)/(B)+1 )

  #endif /* UTIL_MACROS_H */



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


Re: [Mesa-dev] [PATCH 1/2] util/macros: Move DIV_ROUND_UP to util/macros.h

2015-04-27 Thread Axel Davy

On 27/04/2015 15:52, Brian Paul wrote :

On 04/26/2015 03:23 PM, Axel Davy wrote:


   */

  #include svga3d_reg.h
+#include util/macros.h


Actually, it looks like this #include may not be needed.

We get ARRAY_SIZE via including svga3d_reg.h, which includes 
svga_types.h, which includes p_compiler.h which includes util/macros.h


Otherwise, for both:

Reviewed-by: Brian Paul bri...@vmware.com



Do you want I remove this include from the patch ? Or that I let it 
there for clarity ?

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


Re: [Mesa-dev] [PATCH 1/2] util/macros: Move DIV_ROUND_UP to util/macros.h

2015-04-27 Thread Brian Paul

On 04/27/2015 11:22 AM, Axel Davy wrote:

On 27/04/2015 15:52, Brian Paul wrote :

On 04/26/2015 03:23 PM, Axel Davy wrote:


   */

  #include svga3d_reg.h
+#include util/macros.h


Actually, it looks like this #include may not be needed.

We get ARRAY_SIZE via including svga3d_reg.h, which includes
svga_types.h, which includes p_compiler.h which includes util/macros.h

Otherwise, for both:

Reviewed-by: Brian Paul bri...@vmware.com




Do you want I remove this include from the patch ? Or that I let it
there for clarity ?


Let's remove it.

-Brian

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


Re: [Mesa-dev] [PATCH 1/2] util/macros: Move DIV_ROUND_UP to util/macros.h

2015-04-26 Thread Axel Davy

On 26/04/2015 23:23, Axel Davy wrote :

Move DIV_ROUND_UP to a shared location accessible everywhere

Signed-off-by: Axel Davy axel.d...@ens.fr
---
I want to use DIV_ROUND_UP in a galliumm nine patch
  src/gallium/auxiliary/util/u_math.h   | 1 -
  src/gallium/drivers/svga/include/svga3d_surfacedefs.h | 3 +--
  src/mesa/main/macros.h| 5 +
  src/util/macros.h | 2 ++
  4 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_math.h 
b/src/gallium/auxiliary/util/u_math.h
index 3d27a59..a2a2d4b 100644
--- a/src/gallium/auxiliary/util/u_math.h
+++ b/src/gallium/auxiliary/util/u_math.h
@@ -796,7 +796,6 @@ void
  util_fpstate_set(unsigned fpstate);
  
  
-

  #ifdef __cplusplus
  }
  #endif


Please forgive that small bad batch there.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 1/2] util/macros: Move DIV_ROUND_UP to util/macros.h

2015-04-26 Thread Axel Davy
Move DIV_ROUND_UP to a shared location accessible everywhere

Signed-off-by: Axel Davy axel.d...@ens.fr
---
I want to use DIV_ROUND_UP in a galliumm nine patch
 src/gallium/auxiliary/util/u_math.h   | 1 -
 src/gallium/drivers/svga/include/svga3d_surfacedefs.h | 3 +--
 src/mesa/main/macros.h| 5 +
 src/util/macros.h | 2 ++
 4 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/gallium/auxiliary/util/u_math.h 
b/src/gallium/auxiliary/util/u_math.h
index 3d27a59..a2a2d4b 100644
--- a/src/gallium/auxiliary/util/u_math.h
+++ b/src/gallium/auxiliary/util/u_math.h
@@ -796,7 +796,6 @@ void
 util_fpstate_set(unsigned fpstate);
 
 
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/gallium/drivers/svga/include/svga3d_surfacedefs.h 
b/src/gallium/drivers/svga/include/svga3d_surfacedefs.h
index 8763cdf..1592fec 100644
--- a/src/gallium/drivers/svga/include/svga3d_surfacedefs.h
+++ b/src/gallium/drivers/svga/include/svga3d_surfacedefs.h
@@ -30,13 +30,12 @@
  */
 
 #include svga3d_reg.h
+#include util/macros.h
 
 #ifndef ARRAY_SIZE
 #define ARRAY_SIZE(A) (sizeof(A) / sizeof(A[0]))
 #endif
 
-#define DIV_ROUND_UP(x, y)  (((x) + (y) - 1) / (y))
-
 #define max_t(type, x, y)  ((x)  (y) ? (x) : (y))
 
 /*
diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h
index 3344ec8..0608650 100644
--- a/src/mesa/main/macros.h
+++ b/src/mesa/main/macros.h
@@ -31,6 +31,7 @@
 #ifndef MACROS_H
 #define MACROS_H
 
+#include util/macros.h
 #include util/u_math.h
 #include imports.h
 
@@ -800,10 +801,6 @@ DIFFERENT_SIGNS(GLfloat x, GLfloat y)
 }
 
 
-/** Compute ceiling of integer quotient of A divided by B. */
-#define DIV_ROUND_UP( A, B )  ( (A) % (B) == 0 ? (A)/(B) : (A)/(B)+1 )
-
-
 /** casts to silence warnings with some compilers */
 #define ENUM_TO_INT(E) ((GLint)(E))
 #define ENUM_TO_FLOAT(E)   ((GLfloat)(GLint)(E))
diff --git a/src/util/macros.h b/src/util/macros.h
index 6c7bda7..3b708ed 100644
--- a/src/util/macros.h
+++ b/src/util/macros.h
@@ -182,5 +182,7 @@ do {   \
 #define UNUSED
 #endif
 
+/** Compute ceiling of integer quotient of A divided by B. */
+#define DIV_ROUND_UP( A, B )  ( (A) % (B) == 0 ? (A)/(B) : (A)/(B)+1 )
 
 #endif /* UTIL_MACROS_H */
-- 
2.1.0

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