summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2014-07-31 02:38:23 -0400
committerRich Felker <dalias@aerifal.cx>2014-07-31 02:38:23 -0400
commitecc082c61b6da9a8b2ae0c07aa3331673834d94a (patch)
tree45cefbc8c2fa4f1e7729d28a0e1435a4bf4769fb /src
parent38db09374a1cf4c2712c980b07b22a67a5f6bbc3 (diff)
downloadmusl-ecc082c61b6da9a8b2ae0c07aa3331673834d94a.tar.gz
implement ffsl and ffsll functions
per the resolution of Austin Group issue #617, these are accepted for XSI option in POSIX future and thus I'm treating them as standard functions.
Diffstat (limited to 'src')
-rw-r--r--src/misc/ffsl.c7
-rw-r--r--src/misc/ffsll.c7
2 files changed, 14 insertions, 0 deletions
diff --git a/src/misc/ffsl.c b/src/misc/ffsl.c
new file mode 100644
index 00000000..0105c66a
--- /dev/null
+++ b/src/misc/ffsl.c
@@ -0,0 +1,7 @@
+#include <strings.h>
+#include "atomic.h"
+
+int ffsl(long i)
+{
+ return i ? a_ctz_l(i)+1 : 0;
+}
diff --git a/src/misc/ffsll.c b/src/misc/ffsll.c
new file mode 100644
index 00000000..0c5ced82
--- /dev/null
+++ b/src/misc/ffsll.c
@@ -0,0 +1,7 @@
+#include <strings.h>
+#include "atomic.h"
+
+int ffsll(long long i)
+{
+ return i ? a_ctz_64(i)+1 : 0;
+}