From fc702cdf534a4694a64408428e8933497a7fc06e Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Wed, 2 Jan 2013 16:07:54 +0000 Subject: [PATCH] sna: Rewrite __fls without dependence upon x86 assembly The asm() prevents SNA from compiling on ia64. Fixes https://bugs.gentoo.org/show_bug.cgi?id=448570 --- src/sna/kgem.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/sna/kgem.c b/src/sna/kgem.c index 3cc79d34..80f25b84 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -516,10 +516,19 @@ static void gem_close(int fd, uint32_t handle) constant inline static unsigned long __fls(unsigned long word) { +#if defined(__GNUC__) && (defined(__x86__) || defined(__x86_64__)) asm("bsr %1,%0" : "=r" (word) : "rm" (word)); return word; +#else + unsigned int v = 1; + + while (word >>= 1) + v++; + + return v; +#endif } constant inline static int cache_bucket(int num_pages)