Find Last Set, in accordance with glibc's ffs.
Signed-off-by: Marcelo Tosatti <[EMAIL PROTECTED]>
Index: kvm-userspace.hotplug3/qemu/cutils.c
===================================================================
--- kvm-userspace.hotplug3.orig/qemu/cutils.c
+++ kvm-userspace.hotplug3/qemu/cutils.c
@@ -135,3 +135,14 @@ char *urldecode(const char *ptr)
return ret;
}
+int fls(int i)
+{
+ int bit;
+
+ for (bit=31; bit >= 0; bit--)
+ if (i & (1 << bit))
+ return bit+1;
+
+ return 0;
+}
+
Index: kvm-userspace.hotplug3/qemu/qemu-common.h
===================================================================
--- kvm-userspace.hotplug3.orig/qemu/qemu-common.h
+++ kvm-userspace.hotplug3/qemu/qemu-common.h
@@ -87,6 +87,7 @@ int stristart(const char *str, const cha
time_t mktimegm(struct tm *tm);
int hex2bin(char ch);
char *urldecode(const char *ptr);
+int fls(int i);
/* Error handling. */
--
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel