aboutsummaryrefslogtreecommitdiffstats
path: root/main/strcompat.c
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-12-02 03:26:16 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-12-02 03:26:16 +0000
commit9b24e69df6d9bf043bc2b5411497b708843fb04d (patch)
tree1f3193e3fae80882dc4d90585f9832b1897361d5 /main/strcompat.c
parent573194c9fe4ad66a490288d26799d9d090bfb73a (diff)
So apparently, some platforms don't have ffsll(3).
The manpage lies; it says that the function is in POSIX, but that's only for ffs(3), not ffsll(3). git-svn-id: http://svn.digium.com/svn/asterisk/trunk@232164 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/strcompat.c')
-rw-r--r--main/strcompat.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/main/strcompat.c b/main/strcompat.c
index 156809003..ff123713e 100644
--- a/main/strcompat.c
+++ b/main/strcompat.c
@@ -386,3 +386,16 @@ uint64_t htonll(uint64_t host64)
}
#endif
+#ifndef HAVE_FFSLL
+int ffsll(long long n)
+{
+ int i;
+ for (i = 0; i < 64; i++) {
+ if ((1LL << i) & n) {
+ return i + 1;
+ }
+ }
+ return 0;
+}
+#endif
+