diff options
author | Chris Wilson <[email protected]> | 2011-02-08 22:58:35 +0000 |
---|---|---|
committer | Chris Wilson <[email protected]> | 2011-02-21 12:59:37 +0000 |
commit | 41260a9bf63aa61f88f188053f1ed4dba3a852d2 (patch) | |
tree | 59aef62f5130eff6daf83ba75550af7bb78c7289 /src/mesa/main/imports.h | |
parent | 8ea6e98c7be6483514769b03ffa6c6f4f7b2e0be (diff) |
i965: Use compiler builtins when available
Signed-off-by: Chris Wilson <[email protected]>
Diffstat (limited to 'src/mesa/main/imports.h')
-rw-r--r-- | src/mesa/main/imports.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index 5ea647ad8d7..a994dbcae8c 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -539,6 +539,18 @@ _mesa_inv_sqrtf(float x); extern void _mesa_init_sqrt_table(void); +#ifdef __GNUC__ +#define _mesa_ffs(i) ffs(i) +#define _mesa_ffsll(i) ffsll(i) + +#if ((_GNUC__ == 3 && __GNUC_MINOR__ >= 4) || __GNUC__ >= 4) +#define _mesa_bitcount(i) __builtin_popcount(i) +#else +extern unsigned int +_mesa_bitcount(unsigned int n); +#endif + +#else extern int _mesa_ffs(int32_t i); @@ -547,6 +559,7 @@ _mesa_ffsll(int64_t i); extern unsigned int _mesa_bitcount(unsigned int n); +#endif extern GLhalfARB _mesa_float_to_half(float f); |