about summary refs log tree commit diff
path: root/arch/i386/atomic_arch.h
diff options
context:
space:
mode:
Diffstat (limited to 'arch/i386/atomic_arch.h')
-rw-r--r--arch/i386/atomic_arch.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/i386/atomic_arch.h b/arch/i386/atomic_arch.h
index 2b1a0490..7d2a48a5 100644
--- a/arch/i386/atomic_arch.h
+++ b/arch/i386/atomic_arch.h
@@ -99,3 +99,10 @@ static inline int a_ctz_l(unsigned long x)
 	__asm__( "bsf %1,%0" : "=r"(r) : "r"(x) );
 	return r;
 }
+
+#define a_clz_32 a_clz_32
+static inline int a_clz_32(uint32_t x)
+{
+	__asm__( "bsr %1,%0 ; xor $31,%0" : "=r"(x) : "r"(x) );
+	return x;
+}