Module: Mesa Branch: master Commit: c1090f3019bbe0ff92455e4a9268f8957af9cda0 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=c1090f3019bbe0ff92455e4a9268f8957af9cda0
Author: Roland Scheidegger <srol...@vmware.com> Date: Thu Jun 9 00:47:19 2011 +0200 mesa: get rid of homegrown logbase2 implementation in drivers Some of the logbase2 functions did just the same as _mesa_logbase2, though they were taking signed numbers (but it shouldn't matter for them). --- src/mesa/drivers/dri/intel/intel_tex_image.c | 16 +--------------- src/mesa/drivers/dri/unichrome/via_tex.c | 14 +------------- 2 files changed, 2 insertions(+), 28 deletions(-) diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 775fd10..bc39f4a 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -32,20 +32,6 @@ */ -static int -logbase2(int n) -{ - GLint i = 1; - GLint log2 = 0; - - while (n > i) { - i *= 2; - log2++; - } - - return log2; -} - /* Otherwise, store it in memory if (Border != 0) or (any dimension == * 1). @@ -118,7 +104,7 @@ intel_miptree_create_for_teximage(struct intel_context *intel, (intel->gen < 4 || firstLevel == 0)) { lastLevel = firstLevel; } else { - lastLevel = firstLevel + logbase2(MAX2(MAX2(width, height), depth)); + lastLevel = firstLevel + _mesa_logbase2(MAX2(MAX2(width, height), depth)); } } diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index 1a0d1ea..fe5480f 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -196,18 +196,6 @@ viaChooseTexFormat( struct gl_context *ctx, GLint internalFormat, return MESA_FORMAT_NONE; /* never get here */ } -static int logbase2(int n) -{ - GLint i = 1; - GLint log2 = 0; - - while (n > i) { - i *= 2; - log2++; - } - - return log2; -} static const char *get_memtype_name( GLint memType ) { @@ -690,7 +678,7 @@ static void viaTexImage(struct gl_context *ctx, } assert(texImage->RowStride == postConvWidth); - viaImage->pitchLog2 = logbase2(postConvWidth * texelBytes); + viaImage->pitchLog2 = _mesa_logbase2(postConvWidth * texelBytes); /* allocate memory */ if (_mesa_is_format_compressed(texImage->TexFormat)) _______________________________________________ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit