[Mesa-dev] [PATCH v2 17/25] util/bitscan: use correct signature for ffs/ffsll
Emil Velikov
emil.l.velikov at gmail.com
Thu Mar 9 19:07:06 UTC 2017
From: Emil Velikov <emil.velikov at collabora.com>
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 <emil.velikov at collabora.com>
---
src/util/bitscan.c | 4 ++--
src/util/bitscan.h | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/util/bitscan.c b/src/util/bitscan.c
index ceca59eba9..7858291bf6 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 32e027165c..7a605e0370 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
--
2.11.1
More information about the mesa-dev
mailing list