[Mesa-dev] [PATCH] util: add log2f for Android

Jose Fonseca jfonseca at vmware.com
Sun Nov 6 14:18:44 PST 2011


I have no objection.

The only thing that I know we could do to improve this situation is to factor out the compiler/os/crt abstractions out of mesa/gallium/etc into a shared library. I brought and been wanting to do this for a long time, but just haven't been able to find opportunity (because it takes time, it will likely destabilize cross-porting to stable/private branches, etc).

Jose

----- Original Message -----
> From: Chia-I Wu <olv at lunarg.com>
> 
> 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.
> ---
>  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 b9295f4..551463f 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
>  
>  
> --
> 1.7.6.3
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
> 


More information about the mesa-dev mailing list