diff options
author | Chia-I Wu <[email protected]> | 2011-11-06 14:48:11 -0700 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2011-11-07 17:04:11 -0700 |
commit | a69da5c0ce3c932b310bca7cd5cce78961f9946b (patch) | |
tree | 570edfe12116b1323d407101a9b31c71dd41a611 /src/gallium/auxiliary/util/u_math.h | |
parent | 2051a118233cb935ab30ce1eab4b9a80aa0238aa (diff) |
util: add log2f for Android
It is needed for nv50's new shader backend. With this change, both u_math.h
and imports.h in core mesa define the same function. I have to #undef log2f
here to avoid the conflict. Not sure if there is a better way to deal with
the situation.
Acked-by: José Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/util/u_math.h')
-rw-r--r-- | src/gallium/auxiliary/util/u_math.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index b9295f4f85c..551463f75cd 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -207,6 +207,17 @@ double log2(double d) return log(d) * (1.0 / M_LN2); } +/* workaround a conflict with main/imports.h */ +#ifdef log2f +#undef log2f +#endif + +static INLINE +float log2f(float f) +{ + return logf(f) * (float) (1.0 / M_LN2); +} + #endif |