[Mesa-dev] [PATCH 05/18] mesa: android has no log2f nor ffs

Ian Romanick idr at freedesktop.org
Wed Aug 17 08:33:20 PDT 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 08/16/2011 11:28 PM, Chia-I Wu wrote:
> Define log2f(v) to be log(v) / M_LN2 and ffs to __builtin_ffs.
> ---
>  src/mesa/main/imports.h |    8 +++++++-
>  1 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
> index 3fa1db0..e404975 100644
> --- a/src/mesa/main/imports.h
> +++ b/src/mesa/main/imports.h
> @@ -134,7 +134,13 @@ typedef union { GLfloat f; GLint i; } fi_type;
>  #define exp2f(f) ((float) exp2(f))
>  #define floorf(f) ((float) floor(f))
>  #define logf(f) ((float) log(f))
> +
> +#ifdef ANDROID
> +#define log2f(f) ((float) (log(f) / M_LN2))
> +#else
>  #define log2f(f) ((float) log2(f))
> +#endif
> +

This should use a HAVE_LOG2 and / or HAVE_LO2F feature macros instead.

>  #define powf(x,y) ((float) pow(x,y))
>  #define sinf(f) ((float) sin(f))
>  #define sinhf(f) ((float) sinh(f))
> @@ -562,7 +568,7 @@ _mesa_init_sqrt_table(void);
>  
>  #ifdef __GNUC__
>  
> -#ifdef __MINGW32__
> +#if defined(__MINGW32__) || defined(ANDROID)
>  #define ffs __builtin_ffs
>  #define ffsll __builtin_ffsll
>  #endif

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk5L3z8ACgkQX1gOwKyEAw8HAwCgiP18s1f5lqm6FoG864zgq53u
xy8AoJlmd46N8CQku9VNgF3dAZL5oVT8
=Hkm/
-----END PGP SIGNATURE-----


More information about the mesa-dev mailing list