From: Marcelo Tosatti <mtosatti@redhat.com>
To: Avi Kivity <avi@qumranet.com>
Cc: kvm-devel <kvm-devel@lists.sourceforge.net>,
Marcelo Tosatti <mtosatti@redhat.com>
Subject: [patch 1/3] QEMU/KVM: add fls()
Date: Mon, 17 Mar 2008 17:20:14 -0300 [thread overview]
Message-ID: <20080317202125.325812182@localhost.localdomain> (raw)
In-Reply-To: 20080317202013.949027343@localhost.localdomain
[-- Attachment #1: add-fls --]
[-- Type: text/plain, Size: 1170 bytes --]
Find Last Set, in accordance with glibc's ffs.
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
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/
next prev parent reply other threads:[~2008-03-17 20:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-17 20:20 [patch 0/3] QEMU: virtio should register power of two sized regions Marcelo Tosatti
2008-03-17 20:20 ` Marcelo Tosatti [this message]
2008-03-17 20:20 ` [patch 2/3] QEMU/KVM: virtio register pow2 memory regions Marcelo Tosatti
2008-03-17 20:20 ` [patch 3/3] QEMU/KVM: bail out if PCI region is not power of two Marcelo Tosatti
2008-03-18 6:38 ` [patch 0/3] QEMU: virtio should register power of two sized regions Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080317202125.325812182@localhost.localdomain \
--to=mtosatti@redhat.com \
--cc=avi@qumranet.com \
--cc=kvm-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.