From c1785c19ca0716a7e85777242949a0c33e28988f Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Sat, 1 Aug 2009 11:03:30 +0200 Subject: mesa st: Move logbase2 function to util/u_math.h --- src/mesa/state_tracker/st_cb_texture.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'src/mesa/state_tracker/st_cb_texture.c') diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index ee71c012c6..e8d7f70ad6 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -59,6 +59,7 @@ #include "util/u_tile.h" #include "util/u_blit.h" #include "util/u_surface.h" +#include "util/u_math.h" #define DBG if (0) printf @@ -237,16 +238,6 @@ do_memcpy(void *dest, const void *src, size_t n) } -static INLINE unsigned -logbase2(unsigned n) -{ - unsigned log2 = 0; - while (n >>= 1) - ++log2; - return log2; -} - - /** * Return default texture usage bitmask for the given texture format. */ @@ -340,9 +331,9 @@ guess_and_alloc_texture(struct st_context *st, lastLevel = firstLevel; } else { - GLuint l2width = logbase2(width); - GLuint l2height = logbase2(height); - GLuint l2depth = logbase2(depth); + GLuint l2width = util_logbase2(width); + GLuint l2height = util_logbase2(height); + GLuint l2depth = util_logbase2(depth); lastLevel = firstLevel + MAX2(MAX2(l2width, l2height), l2depth); } -- cgit v1.2.3