From: Emil Velikov Date: Thu, 9 Mar 2017 17:45:19 +0000 (+0000) Subject: util/bitscan: use correct signature for ffs/ffsll X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a72ac981605d34be5b9da3d9ee8e43b81c5a5296;p=mesa.git util/bitscan: use correct signature for ffs/ffsll Otherwise we'll get errors such as error: conflicting types for ‘ffs’ error: conflicting types for ‘ffsll’ We might want to improve the heuristics and provide a definition only when a native one is missing. We can address that at a later stage. Signed-off-by: Emil Velikov Reviewed-by: Jason Ekstrand --- diff --git a/src/util/bitscan.c b/src/util/bitscan.c index ceca59eba98..7858291bf63 100644 --- a/src/util/bitscan.c +++ b/src/util/bitscan.c @@ -32,7 +32,7 @@ #elif defined(_MSC_VER) && (_M_IX86 || _M_ARM || _M_AMD64 || _M_IA64) #else int -ffs(unsigned i) +ffs(int i) { int bit = 0; if (!i) @@ -63,7 +63,7 @@ ffs(unsigned i) #elif defined(_MSC_VER) && (_M_AMD64 || _M_ARM || _M_IA64) #else int -ffsll(uint64_t val) +ffsll(long long int val) { int bit; diff --git a/src/util/bitscan.h b/src/util/bitscan.h index 32e027165cc..7a605e0370f 100644 --- a/src/util/bitscan.h +++ b/src/util/bitscan.h @@ -52,7 +52,7 @@ extern "C" { #define ffs __builtin_ffs #elif defined(_MSC_VER) && (_M_IX86 || _M_ARM || _M_AMD64 || _M_IA64) static inline -int ffs(unsigned i) +int ffs(int i) { unsigned long index; if (_BitScanForward(&index, i)) @@ -62,14 +62,14 @@ int ffs(unsigned i) } #else extern -int ffs(unsigned i); +int ffs(int i); #endif #ifdef HAVE___BUILTIN_FFSLL #define ffsll __builtin_ffsll #elif defined(_MSC_VER) && (_M_AMD64 || _M_ARM || _M_IA64) static inline int -ffsll(uint64_t i) +ffsll(long long int i) { unsigned long index; if (_BitScanForward64(&index, i)) @@ -79,7 +79,7 @@ ffsll(uint64_t i) } #else extern int -ffsll(uint64_t val); +ffsll(long long int val); #endif