aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2008-12-04 20:08:06 +0000
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2008-12-04 20:08:06 +0000
commit8d371d4bceb308c29a5db4c21c984e06c9d56371 (patch)
tree6dc763cd84a800bfed065397478b7cdbc896fecb /cutils.c
parentRemove TARGET_PAGE_SIZE from virtio interface (Hollis Blanchard) (diff)
downloadqemu-kvm-8d371d4bceb308c29a5db4c21c984e06c9d56371.tar.gz
qemu-kvm-8d371d4bceb308c29a5db4c21c984e06c9d56371.tar.bz2
qemu-kvm-8d371d4bceb308c29a5db4c21c984e06c9d56371.zip
Define fls() in terms of clz32().
As suggested by Laurent Desnogues. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5872 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'cutils.c')
-rw-r--r--cutils.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/cutils.c b/cutils.c
index 9f124f5ea..2d65357ee 100644
--- a/cutils.c
+++ b/cutils.c
@@ -22,6 +22,7 @@
* THE SOFTWARE.
*/
#include "qemu-common.h"
+#include "host-utils.h"
void pstrcpy(char *buf, int buf_size, const char *str)
{
@@ -98,11 +99,5 @@ time_t mktimegm(struct tm *tm)
int fls(int i)
{
- int bit;
-
- for (bit=31; bit >= 0; bit--)
- if (i & (1 << bit))
- return bit+1;
-
- return 0;
+ return 32 - clz32(i);
}