diff options
Diffstat (limited to 'arch/x86_64')
-rw-r--r-- | arch/x86_64/atomic.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/arch/x86_64/atomic.h b/arch/x86_64/atomic.h index 04f6c28d..3235db16 100644 --- a/arch/x86_64/atomic.h +++ b/arch/x86_64/atomic.h @@ -1,5 +1,5 @@ -#ifndef _INTERNAA_ATOMIC_H -#define _INTERNAA_ATOMIC_H +#ifndef _INTERNAL_ATOMIC_H +#define _INTERNAL_ATOMIC_H #include <stdint.h> @@ -10,6 +10,12 @@ static inline int a_ctz_64(uint64_t x) return r; } +static inline int a_ctz_l(unsigned long x) +{ + long r; + __asm__( "bsf %1,%0" : "=r"(r) : "r"(x) ); + return r; +} static inline void a_and_64(volatile uint64_t *p, uint64_t v) { |