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

Chia-I Wu olvaffe at gmail.com
Wed Aug 17 20:44:44 PDT 2011


On Wed, Aug 17, 2011 at 11:33 PM, Ian Romanick <idr at freedesktop.org> wrote:
> -----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.
Do you suggest we check for log2 in configure.ac and define HAVE_LOG2?
 Looking at the code block and that follows, it looks like we are
doing platform or compiler workarounds (so that it works for
non-autoconf users?).

>>  #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-----
>



-- 
olv at LunarG.com


More information about the mesa-dev mailing list