gallium: replace align_int() with align()

The two functions are identical.  Removed align_int() from p_util.h
This commit is contained in:
Brian Paul
2008-08-22 16:09:37 -06:00
parent f9c04d55d0
commit a13475ff00
4 changed files with 14 additions and 19 deletions

View File

@@ -119,7 +119,7 @@ static void fetch_pipeline_run( struct draw_pt_middle_end *middle,
struct draw_context *draw = fpme->draw; struct draw_context *draw = fpme->draw;
struct draw_vertex_shader *shader = draw->vs.vertex_shader; struct draw_vertex_shader *shader = draw->vs.vertex_shader;
unsigned opt = fpme->opt; 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 *pipeline_verts =
(struct vertex_header *)MALLOC(fpme->vertex_size * alloc_count); (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_context *draw = fpme->draw;
struct draw_vertex_shader *shader = draw->vs.vertex_shader; struct draw_vertex_shader *shader = draw->vs.vertex_shader;
unsigned opt = fpme->opt; 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 *pipeline_verts =
(struct vertex_header *)MALLOC(fpme->vertex_size * alloc_count); (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_context *draw = fpme->draw;
struct draw_vertex_shader *shader = draw->vs.vertex_shader; struct draw_vertex_shader *shader = draw->vs.vertex_shader;
unsigned opt = fpme->opt; 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 *pipeline_verts =
(struct vertex_header *)MALLOC(fpme->vertex_size * alloc_count); (struct vertex_header *)MALLOC(fpme->vertex_size * alloc_count);

View File

@@ -220,7 +220,7 @@ i945_miptree_layout_2d( struct i915_texture *tex )
*/ */
if (pt->last_level > 0) { if (pt->last_level > 0) {
unsigned mip1_nblocksx 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))); + pf_get_nblocksx(&pt->block, minify(minify(width)));
if (mip1_nblocksx > nblocksx) if (mip1_nblocksx > nblocksx)
@@ -229,14 +229,14 @@ i945_miptree_layout_2d( struct i915_texture *tex )
/* Pitch must be a whole number of dwords /* 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; tex->total_nblocksy = 0;
for (level = 0; level <= pt->last_level; level++) { for (level = 0; level <= pt->last_level; level++) {
i915_miptree_set_level_info(tex, level, 1, width, height, 1); i915_miptree_set_level_info(tex, level, 1, width, height, 1);
i915_miptree_set_image_offset(tex, level, 0, x, y); 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 /* Because the images are packed better, the final offset
* might not be the maximal one: * 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. /* Layout_below: step right after second mipmap level.
*/ */
if (level == 1) { if (level == 1) {
x += align_int(nblocksx, align_x); x += align(nblocksx, align_x);
} }
else { else {
y += nblocksy; y += nblocksy;

View File

@@ -144,7 +144,7 @@ static void i945_miptree_layout_2d(struct brw_texture *tex)
*/ */
if (pt->last_level > 0) { if (pt->last_level > 0) {
unsigned mip1_nblocksx 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))); + pf_get_nblocksx(&pt->block, minify(minify(width)));
if (mip1_nblocksx > nblocksx) 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 /* 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; tex->total_nblocksy = 0;
for (level = 0; level <= pt->last_level; level++) { for (level = 0; level <= pt->last_level; level++) {
intel_miptree_set_level_info(tex, level, 1, x, y, width, intel_miptree_set_level_info(tex, level, 1, x, y, width,
height, 1); height, 1);
nblocksy = align_int(nblocksy, align_y); nblocksy = align(nblocksy, align_y);
/* Because the images are packed better, the final offset /* Because the images are packed better, the final offset
* might not be the maximal one: * 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. /* Layout_below: step right after second mipmap level.
*/ */
if (level == 1) { if (level == 1) {
x += align_int(nblocksx, align_x); x += align(nblocksx, align_x);
} }
else { else {
y += nblocksy; y += nblocksy;

View 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) #if defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86)
static INLINE unsigned ffs( unsigned u ) static INLINE unsigned ffs( unsigned u )
{ {
@@ -399,12 +400,6 @@ do { \
} while (0) } while (0)
static INLINE int align(int value, int alignment)
{
return (value + alignment - 1) & ~(alignment - 1);
}
/* util/p_util.c /* util/p_util.c
*/ */
extern void pipe_copy_rect(ubyte * dst, const struct pipe_format_block *block, extern void pipe_copy_rect(ubyte * dst, const struct pipe_format_block *block,