util_logbase2 is exactly the same function.
Signed-off-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
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, "");
#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.
*/
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");
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);
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;
}