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

index c7bbebc42867832969312ba16bd01647569745ad..aee69ab7bae9a0c659ba75ac3bfb808b08d2ec23 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