about summary refs log tree commit diff
path: root/arch/x86_64
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64')
-rw-r--r--arch/x86_64/atomic_arch.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/arch/x86_64/atomic_arch.h b/arch/x86_64/atomic_arch.h
index 55fc6fb9..da4e2037 100644
--- a/arch/x86_64/atomic_arch.h
+++ b/arch/x86_64/atomic_arch.h
@@ -114,3 +114,10 @@ static inline int a_ctz_64(uint64_t x)
 	__asm__( "bsf %1,%0" : "=r"(x) : "r"(x) );
 	return x;
 }
+
+#define a_clz_64 a_clz_64
+static inline int a_clz_64(uint64_t x)
+{
+	__asm__( "bsr %1,%0 ; xor $63,%0" : "=r"(x) : "r"(x) );
+	return x;
+}