util: Optimise log2().
authorMichal Krol <michal@tungstengraphics.com>
Wed, 12 Nov 2008 18:01:46 +0000 (19:01 +0100)
committerMichal Krol <michal@tungstengraphics.com>
Wed, 12 Nov 2008 18:01:46 +0000 (19:01 +0100)
src/gallium/auxiliary/util/u_math.h

index 62272110ce3362d8462acddab94cbabe7b4baa3b..fdaec8df82362046082a902c0294dbfeb38df002 100644 (file)
@@ -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