gallium: replace align_int() with align()
authorBrian Paul <brian.paul@tungstengraphics.com>
Fri, 22 Aug 2008 22:09:37 +0000 (16:09 -0600)
committerBrian Paul <brian.paul@tungstengraphics.com>
Fri, 22 Aug 2008 22:09:37 +0000 (16:09 -0600)
The two functions are identical.  Removed align_int() from p_util.h

src/gallium/auxiliary/draw/draw_pt_fetch_shade_pipeline.c
src/gallium/drivers/i915simple/i915_texture.c
src/gallium/drivers/i965simple/brw_tex_layout.c
src/gallium/include/pipe/p_util.h

index 0aec4b7..be3535e 100644 (file)
@@ -119,7 +119,7 @@ static void fetch_pipeline_run( struct draw_pt_middle_end *middle,
    struct draw_context *draw = fpme->draw;
    struct draw_vertex_shader *shader = draw->vs.vertex_shader;
    unsigned opt = fpme->opt;
-   unsigned alloc_count = align_int( fetch_count, 4 );
+   unsigned alloc_count = align( fetch_count, 4 );
 
    struct vertex_header *pipeline_verts = 
       (struct vertex_header *)MALLOC(fpme->vertex_size * alloc_count);
@@ -195,7 +195,7 @@ static void fetch_pipeline_linear_run( struct draw_pt_middle_end *middle,
    struct draw_context *draw = fpme->draw;
    struct draw_vertex_shader *shader = draw->vs.vertex_shader;
    unsigned opt = fpme->opt;
-   unsigned alloc_count = align_int( count, 4 );
+   unsigned alloc_count = align( count, 4 );
 
    struct vertex_header *pipeline_verts =
       (struct vertex_header *)MALLOC(fpme->vertex_size * alloc_count);
@@ -271,7 +271,7 @@ static void fetch_pipeline_linear_run_elts( struct draw_pt_middle_end *middle,
    struct draw_context *draw = fpme->draw;
    struct draw_vertex_shader *shader = draw->vs.vertex_shader;
    unsigned opt = fpme->opt;
-   unsigned alloc_count = align_int( count, 4 );
+   unsigned alloc_count = align( count, 4 );
 
    struct vertex_header *pipeline_verts =
       (struct vertex_header *)MALLOC(fpme->vertex_size * alloc_count);
index cf4964b..ca0fb87 100644 (file)
@@ -220,7 +220,7 @@ i945_miptree_layout_2d( struct i915_texture *tex )
     */
    if (pt->last_level > 0) {
       unsigned mip1_nblocksx 
-        = align_int(pf_get_nblocksx(&pt->block, minify(width)), align_x)
+        = align(pf_get_nblocksx(&pt->block, minify(width)), align_x)
          + pf_get_nblocksx(&pt->block, minify(minify(width)));
 
       if (mip1_nblocksx > nblocksx)
@@ -229,14 +229,14 @@ i945_miptree_layout_2d( struct i915_texture *tex )
 
    /* Pitch must be a whole number of dwords
     */
-   tex->stride = align_int(tex->stride, 64);
+   tex->stride = align(tex->stride, 64);
    tex->total_nblocksy = 0;
 
    for (level = 0; level <= pt->last_level; level++) {
       i915_miptree_set_level_info(tex, level, 1, width, height, 1);
       i915_miptree_set_image_offset(tex, level, 0, x, y);
 
-      nblocksy = align_int(nblocksy, align_y);
+      nblocksy = align(nblocksy, align_y);
 
       /* Because the images are packed better, the final offset
        * might not be the maximal one:
@@ -246,7 +246,7 @@ i945_miptree_layout_2d( struct i915_texture *tex )
       /* Layout_below: step right after second mipmap level.
        */
       if (level == 1) {
-        x += align_int(nblocksx, align_x);
+        x += align(nblocksx, align_x);
       }
       else {
         y += nblocksy;
index 8c77256..9b6cf81 100644 (file)
@@ -144,7 +144,7 @@ static void i945_miptree_layout_2d(struct brw_texture *tex)
     */
    if (pt->last_level > 0) {
       unsigned mip1_nblocksx 
-        = align_int(pf_get_nblocksx(&pt->block, minify(width)), align_x)
+        = align(pf_get_nblocksx(&pt->block, minify(width)), align_x)
          + pf_get_nblocksx(&pt->block, minify(minify(width)));
 
       if (mip1_nblocksx > nblocksx)
@@ -153,14 +153,14 @@ static void i945_miptree_layout_2d(struct brw_texture *tex)
 
    /* Pitch must be a whole number of dwords
     */
-   tex->stride = align_int(tex->stride, 64);
+   tex->stride = align(tex->stride, 64);
    tex->total_nblocksy = 0;
 
    for (level = 0; level <= pt->last_level; level++) {
       intel_miptree_set_level_info(tex, level, 1, x, y, width,
                                   height, 1);
 
-      nblocksy = align_int(nblocksy, align_y);
+      nblocksy = align(nblocksy, align_y);
 
       /* Because the images are packed better, the final offset
        * might not be the maximal one:
@@ -170,7 +170,7 @@ static void i945_miptree_layout_2d(struct brw_texture *tex)
       /* Layout_below: step right after second mipmap level.
        */
       if (level == 1) {
-        x += align_int(nblocksx, align_x);
+        x += align(nblocksx, align_x);
       }
       else {
         y += nblocksy;
index 8f5cb4d..cac0039 100644 (file)
@@ -289,13 +289,14 @@ align16( void *unaligned )
 }
 
 
-static INLINE int align_int(int x, int align)
+static INLINE int align(int value, int alignment)
 {
-   return (x + align - 1) & ~(align - 1);
+   return (value + alignment - 1) & ~(alignment - 1);
 }
 
 
 
+
 #if defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86)
 static INLINE unsigned ffs( unsigned u )
 {
@@ -399,12 +400,6 @@ do {                                     \
 } while (0)
 
 
-static INLINE int align(int value, int alignment)
-{
-   return (value + alignment - 1) & ~(alignment - 1);
-}
-
-
 /* util/p_util.c
  */
 extern void pipe_copy_rect(ubyte * dst, const struct pipe_format_block *block,