summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/util/u_math.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/auxiliary/util/u_math.h')
-rw-r--r--src/gallium/auxiliary/util/u_math.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h
index d2eaa2e7f7..fdaec8df82 100644
--- a/src/gallium/auxiliary/util/u_math.h
+++ b/src/gallium/auxiliary/util/u_math.h
@@ -161,6 +161,12 @@ static INLINE float logf( float f )
return (float) log( (double) f );
}
+static INLINE double log2( double x )
+{
+ const double invln2 = 1.442695041;
+ return log( x ) * invln2;
+}
+
#else
/* Work-around an extra semi-colon in VS 2005 logf definition */
#ifdef logf