Remove redundant util_unsigned_logbase2
authorMatt Turner <mattst88@gmail.com>
Mon, 9 May 2011 04:17:01 +0000 (00:17 -0400)
committerBrian Paul <brianp@vmware.com>
Thu, 12 May 2011 22:37:34 +0000 (16:37 -0600)
util_logbase2 is exactly the same function.

Signed-off-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
src/gallium/auxiliary/gallivm/lp_bld_sample.c
src/gallium/auxiliary/util/u_math.h
src/gallium/drivers/llvmpipe/lp_rast_debug.c
src/gallium/drivers/nv50/nv50_screen.c
src/gallium/drivers/softpipe/sp_tex_sample.c

index 4636371a0f5713884d4b019b04dccd43caded23a..cb6717d7f63ab1046b3b409930fe08a9d6982c98 100644 (file)
@@ -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, "");
index ad2a1f835cafdaa2c975d1c7d82f0b573fc74fd3..2ecade5f7e47b766a021197c2d93e0f36648505b 100644 (file)
@@ -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.
  */
index 64ac616f629fbb416fd9e4679f6f226e16e5bc6a..bc7dc646ded48946515b1cb6773cf76f323121ed 100644 (file)
@@ -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");
index a5a45a6928495afa7f992ac45d68c909d9f72122..cc921d08666c6d48c70eb90153277d25e270bcd8 100644 (file)
@@ -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);
index 02892c16bde4103cb2d6c71a3e683b7d08e7ef31..1446aee2aa4bbab89bc16a3f09cf37c3deaa653e 100644 (file)
@@ -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;
 }