diff options
author | Matt Turner <mattst88@gmail.com> | 2013-01-02 16:07:54 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-01-02 16:23:13 +0000 |
commit | fc702cdf534a4694a64408428e8933497a7fc06e (patch) | |
tree | 1615e417cf9fa683c04edbb7f74d282a2d6bd42d | |
parent | bc67bdcec832f4302951f2789456666dee2f496c (diff) |
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
-rw-r--r-- | src/sna/kgem.c | 9 |
1 files changed, 9 insertions, 0 deletions
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) |