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