diff options
author | aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-10-12 11:44:36 +0000 |
---|---|---|
committer | aurel32 <aurel32@c046a42c-6fe2-441c-8c8c-71466251a162> | 2008-10-12 11:44:36 +0000 |
commit | 5b7ada46e5eca0fa9c94def7d5fa548590fac826 (patch) | |
tree | 7597068207057e9e0db641bf760d53bb222da8be /host-utils.h | |
parent | hw/apic.c: use __builtin funtions instead of assembly code (diff) | |
download | qemu-kvm-5b7ada46e5eca0fa9c94def7d5fa548590fac826.tar.gz qemu-kvm-5b7ada46e5eca0fa9c94def7d5fa548590fac826.tar.bz2 qemu-kvm-5b7ada46e5eca0fa9c94def7d5fa548590fac826.zip |
Only use __builtin_* with GCC >= 3.4
Fix gcc 3.3 builds, broken in revision 5465.
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5466 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'host-utils.h')
-rw-r--r-- | host-utils.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/host-utils.h b/host-utils.h index c907fe839..2a46c9baf 100644 --- a/host-utils.h +++ b/host-utils.h @@ -51,7 +51,7 @@ void mulu64(uint64_t *phigh, uint64_t *plow, uint64_t a, uint64_t b); static always_inline int clz32(uint32_t val) { -#if defined(__GNUC__) +#if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) if (val) return __builtin_clz(val); else @@ -93,7 +93,7 @@ static always_inline int clo32(uint32_t val) static always_inline int clz64(uint64_t val) { -#if defined(__GNUC__) +#if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) if (val) return __builtin_clzll(val); else @@ -118,7 +118,7 @@ static always_inline int clo64(uint64_t val) static always_inline int ctz32 (uint32_t val) { -#if defined(__GNUC__) +#if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) if (val) return __builtin_ctz(val); else @@ -162,7 +162,7 @@ static always_inline int cto32 (uint32_t val) static always_inline int ctz64 (uint64_t val) { -#if defined(__GNUC__) +#if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) if (val) return __builtin_ctz(val); else @@ -206,7 +206,7 @@ static always_inline int ctpop16 (uint16_t val) static always_inline int ctpop32 (uint32_t val) { -#if defined(__GNUC__) +#if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) return __builtin_popcount(val); #else val = (val & 0x55555555) + ((val >> 1) & 0x55555555); @@ -221,7 +221,7 @@ static always_inline int ctpop32 (uint32_t val) static always_inline int ctpop64 (uint64_t val) { -#if defined(__GNUC__) +#if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) return __builtin_popcountll(val); #else val = (val & 0x5555555555555555ULL) + ((val >> 1) & 0x5555555555555555ULL); |