From c5ac8a8aa2a9fe751453c1fcc8539b7dae5d473c Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Mon, 9 May 2011 00:17:01 -0400 Subject: [PATCH] Remove redundant util_unsigned_logbase2 util_logbase2 is exactly the same function. Signed-off-by: Matt Turner Signed-off-by: Brian Paul --- src/gallium/auxiliary/gallivm/lp_bld_sample.c | 2 +- src/gallium/auxiliary/util/u_math.h | 12 ------------ src/gallium/drivers/llvmpipe/lp_rast_debug.c | 2 +- src/gallium/drivers/nv50/nv50_screen.c | 2 +- src/gallium/drivers/softpipe/sp_tex_sample.c | 4 ++-- 5 files changed, 5 insertions(+), 17 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_sample.c b/src/gallium/auxiliary/gallivm/lp_bld_sample.c index 4636371a0f5..cb6717d7f63 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_sample.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_sample.c @@ -1055,7 +1055,7 @@ lp_build_sample_partial_offset(struct lp_build_context *bld, subcoord = LLVMBuildURem(builder, coord, block_width, ""); coord = LLVMBuildUDiv(builder, coord, block_width, ""); #else - unsigned logbase2 = util_unsigned_logbase2(block_length); + unsigned logbase2 = util_logbase2(block_length); LLVMValueRef block_shift = lp_build_const_int_vec(bld->gallivm, bld->type, logbase2); LLVMValueRef block_mask = lp_build_const_int_vec(bld->gallivm, bld->type, block_length - 1); subcoord = LLVMBuildAnd(builder, coord, block_mask, ""); diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index ad2a1f835ca..2ecade5f7e4 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -414,18 +414,6 @@ unsigned ffs( unsigned u ) #endif -/* Could also binary search for the highest bit. - */ -static INLINE unsigned -util_unsigned_logbase2(unsigned n) -{ - unsigned log2 = 0; - while (n >>= 1) - ++log2; - return log2; -} - - /** * Return float bits. */ diff --git a/src/gallium/drivers/llvmpipe/lp_rast_debug.c b/src/gallium/drivers/llvmpipe/lp_rast_debug.c index 64ac616f629..bc7dc646ded 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_debug.c +++ b/src/gallium/drivers/llvmpipe/lp_rast_debug.c @@ -398,7 +398,7 @@ lp_debug_draw_bins_by_cmd_length( struct lp_scene *scene ) for (x = 0; x < scene->tiles_x; x++) { const char *bits = " ...,-~:;=o+xaw*#XAWWWWWWWWWWWWWWWW"; int sz = lp_scene_bin_size(scene, x, y); - int sz2 = util_unsigned_logbase2(sz); + int sz2 = util_logbase2(sz); debug_printf("%c", bits[MIN2(sz2,32)]); } debug_printf("\n"); diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index a5a45a69284..cc921d08666 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -489,7 +489,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) BEGIN_RING(chan, RING_3D(LOCAL_ADDRESS_HIGH), 3); OUT_RELOCh(chan, screen->tls_bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR); OUT_RELOCl(chan, screen->tls_bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RDWR); - OUT_RING (chan, util_unsigned_logbase2(tls_space / 8)); + OUT_RING (chan, util_logbase2(tls_space / 8)); ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 1 << 16, 4 << 16, &screen->uniforms); diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 02892c16bde..1446aee2aa4 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -2243,8 +2243,8 @@ sp_sampler_variant_bind_view( struct sp_sampler_variant *samp, samp->view = view; samp->cache = tex_cache; - samp->xpot = util_unsigned_logbase2( texture->width0 ); - samp->ypot = util_unsigned_logbase2( texture->height0 ); + samp->xpot = util_logbase2( texture->width0 ); + samp->ypot = util_logbase2( texture->height0 ); samp->level = view->u.tex.first_level; } -- 2.30.2