From 869b8ad499717eda4a1be04de4e516134123402c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sat, 20 Jan 2007 18:06:38 -0800 Subject: Add _mesa_ffsll() for compatibility on OSes without ffsll(), and use it. --- src/mesa/main/imports.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/mesa/main/imports.c') diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 996839a20e..ad77373075 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -574,6 +574,27 @@ _mesa_ffs(int i) #endif } +int +_mesa_ffsll(long long val) +{ +#ifdef ffsll + return ffsll(val); +#else + int bit; + + assert(sizeof(val) == 8); + + bit = ffs(val); + if (bit != 0) + return bit; + + bit = ffs(val >> 32); + if (bit != 0) + return 32 + bit; + + return 0; +#endif +} /** * Return number of bits set in given GLuint. -- cgit v1.2.3