mesa: Rename the CEILING() macro to DIV_ROUND_UP().
authorFrancisco Jerez <currojerez@riseup.net>
Tue, 10 Feb 2015 13:37:47 +0000 (15:37 +0200)
committerFrancisco Jerez <currojerez@riseup.net>
Tue, 10 Feb 2015 13:37:47 +0000 (15:37 +0200)
Some people have complained that code using the CEILING() macro is
difficult to understand because it's not immediately obvious what it
is supposed to do until you go and look up its definition.  Use a more
descriptive name that matches the similar utility macro in the Linux
kernel.

Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/main/image.c
src/mesa/main/macros.h
src/mesa/main/pack.c

index c37900cf9540ead3397ce7fc612288b689d33b55..e97b006e0718437d007f0edf82f1325b03ec560a 100644 (file)
@@ -151,7 +151,7 @@ _mesa_image_offset( GLuint dimensions,
       assert(format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX);
 
       bytes_per_row = alignment
-                    * CEILING( comp_per_pixel*pixels_per_row, 8*alignment );
+                    * DIV_ROUND_UP( comp_per_pixel*pixels_per_row, 8*alignment );
 
       bytes_per_image = bytes_per_row * rows_per_image;
 
index cd5f2d6f28b9b1fa38ff3f56abc5f85c2cb9cc58..2d59c6f1e3d444da4a4d75a689ed522afd2172a1 100644 (file)
@@ -808,7 +808,7 @@ DIFFERENT_SIGNS(GLfloat x, GLfloat y)
 
 
 /** Compute ceiling of integer quotient of A divided by B. */
-#define CEILING( A, B )  ( (A) % (B) == 0 ? (A)/(B) : (A)/(B)+1 )
+#define DIV_ROUND_UP( A, B )  ( (A) % (B) == 0 ? (A)/(B) : (A)/(B)+1 )
 
 
 /** casts to silence warnings with some compilers */
index 4cc8468d0d9e5ac81ba5230860187559f35afb6c..2111a76040071f05cf44d339e3cee3fb1fa937e0 100644 (file)
@@ -155,7 +155,7 @@ _mesa_pack_bitmap( GLint width, GLint height, const GLubyte *source,
    if (!source)
       return;
 
-   width_in_bytes = CEILING( width, 8 );
+   width_in_bytes = DIV_ROUND_UP( width, 8 );
    src = source;
    for (row = 0; row < height; row++) {
       GLubyte *dst = (GLubyte *) _mesa_image_address2d(packing, dest,