aboutsummaryrefslogtreecommitdiff
path: root/src/misc/ffsl.c
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/misc/ffsl.c
parentlimit visibility of ffs function declaration to _XOPEN_SOURCE (diff)
downloadgrovel-ecc082c61b6da9a8b2ae0c07aa3331673834d94a.tar.gz
grovel-ecc082c61b6da9a8b2ae0c07aa3331673834d94a.tar.xz
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/misc/ffsl.c')
-rw-r--r--src/misc/ffsl.c7
1 files changed, 7 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;
+}