about summary refs log tree commit diff
path: root/src/misc/ffsll.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/misc/ffsll.c')
-rw-r--r--src/misc/ffsll.c7
1 files changed, 7 insertions, 0 deletions
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;
+}