Fix gcc version checks for _mesa_bitcount

- Fix _GNUC__ typo in both checks
- Fix logic error in check for gcc < 3.4 that breaks for gcc 2.x & older

Without this fix, builds with gcc 3.4.x end up depending on undefined
_mesa_bitcount instead of gcc's __builtin_popcount.

NOTE: This is a candidate for the stable branches.

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Alan Coopersmith 2011-10-20 17:14:05 -07:00
parent df8f864bf6
commit 8c509e1181
2 changed files with 2 additions and 2 deletions

View File

@ -514,7 +514,7 @@ _mesa_ffsll(int64_t val)
#endif #endif
#if !defined(__GNUC__) ||\ #if !defined(__GNUC__) ||\
((_GNUC__ == 3 && __GNUC_MINOR__ < 4) && __GNUC__ < 4) ((__GNUC__ * 100 + __GNUC_MINOR__) < 304) /* Not gcc 3.4 or later */
/** /**
* Return number of bits set in given GLuint. * Return number of bits set in given GLuint.
*/ */

View File

@ -576,7 +576,7 @@ _mesa_init_sqrt_table(void);
#define _mesa_ffs(i) ffs(i) #define _mesa_ffs(i) ffs(i)
#define _mesa_ffsll(i) ffsll(i) #define _mesa_ffsll(i) ffsll(i)
#if ((_GNUC__ == 3 && __GNUC_MINOR__ >= 4) || __GNUC__ >= 4) #if ((__GNUC__ * 100 + __GNUC_MINOR__) >= 304) /* gcc 3.4 or later */
#define _mesa_bitcount(i) __builtin_popcount(i) #define _mesa_bitcount(i) __builtin_popcount(i)
#define _mesa_bitcount_64(i) __builtin_popcountll(i) #define _mesa_bitcount_64(i) __builtin_popcountll(i)
#else #else