From 5c337508feedfa35ba3f534bf212f08265db2022 Mon Sep 17 00:00:00 2001 From: michal Date: Wed, 29 Aug 2007 21:40:18 +0100 Subject: [PATCH] Fix ffs(). --- src/mesa/pipe/p_util.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) mode change 100644 => 100755 src/mesa/pipe/p_util.h diff --git a/src/mesa/pipe/p_util.h b/src/mesa/pipe/p_util.h old mode 100644 new mode 100755 index 3eff332..436bda2 --- a/src/mesa/pipe/p_util.h +++ b/src/mesa/pipe/p_util.h @@ -39,10 +39,10 @@ #define Elements(x) sizeof(x)/sizeof(*(x)) /** - * Return pointer aligned to next multiple of 16 bytes. + * Return a pointer aligned to next multiple of 16 bytes. */ static INLINE void * -align16(void *unaligned) +align16( void *unaligned ) { union { void *p; @@ -59,7 +59,12 @@ static INLINE unsigned ffs( unsigned u ) { unsigned i; + if( u == 0 ) { + return 0; + } + __asm bsf eax, [u] + __asm inc eax __asm mov [i], eax return i; -- 2.7.4