summaryrefslogtreecommitdiff
path: root/arch/i386/atomic.h
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-04-27 12:19:49 -0400
committerRich Felker <dalias@aerifal.cx>2011-04-27 12:19:49 -0400
commit4bb9b4f3b4a6794da3091f58acbd938ff66fc15b (patch)
tree99bc7b287ccfe21f5f10dfa950be9ca598e2074c /arch/i386/atomic.h
parentb5b41212a686849fe061b8c4bb80d38f893d00c7 (diff)
downloadmusl-4bb9b4f3b4a6794da3091f58acbd938ff66fc15b.tar.gz
add word-sized ctz function to atomic.h
strictly speaking this and a few other ops should be factored into asm.h or the file should just be renamed to asm.h, but whatever. clean it up someday.
Diffstat (limited to 'arch/i386/atomic.h')
-rw-r--r--arch/i386/atomic.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/arch/i386/atomic.h b/arch/i386/atomic.h
index bf3c336e..66059af9 100644
--- a/arch/i386/atomic.h
+++ b/arch/i386/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>
@@ -11,6 +11,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)
{