From c5ba8ba9182a6946ee489241738457b1370b3c77 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Wed, 12 Nov 2008 19:01:46 +0100 Subject: [PATCH] util: Optimise log2(). --- src/gallium/auxiliary/util/u_math.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index 62272110ce3..fdaec8df823 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -163,7 +163,8 @@ static INLINE float logf( float f ) static INLINE double log2( double x ) { - return log( x ) / log( 2.0 ); + const double invln2 = 1.442695041; + return log( x ) * invln2; } #else -- 2.30.2