From: Aurelien Jarno <aurelien@aurel32.net>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [5469] hw/apic.c: use functions from host-utils.h
Date: Sun, 12 Oct 2008 20:16:05 +0000 [thread overview]
Message-ID: <E1Kp7MD-0000c7-Kl@cvs.savannah.gnu.org> (raw)
Revision: 5469
http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5469
Author: aurel32
Date: 2008-10-12 20:16:03 +0000 (Sun, 12 Oct 2008)
Log Message:
-----------
hw/apic.c: use functions from host-utils.h
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Modified Paths:
--------------
trunk/hw/apic.c
Modified: trunk/hw/apic.c
===================================================================
--- trunk/hw/apic.c 2008-10-12 17:54:42 UTC (rev 5468)
+++ trunk/hw/apic.c 2008-10-12 20:16:03 UTC (rev 5469)
@@ -20,7 +20,7 @@
#include "hw.h"
#include "pc.h"
#include "qemu-timer.h"
-#include "osdep.h"
+#include "host-utils.h"
//#define DEBUG_APIC
//#define DEBUG_IOAPIC
@@ -108,45 +108,13 @@
/* Find first bit starting from msb */
static int fls_bit(uint32_t value)
{
-#if QEMU_GNUC_PREREQ(3, 4)
- return 31 - __builtin_clz(value);
-#else
- unsigned int ret = 0;
-
- if (value > 0xffff)
- value >>= 16, ret = 16;
- if (value > 0xff)
- value >>= 8, ret += 8;
- if (value > 0xf)
- value >>= 4, ret += 4;
- if (value > 0x3)
- value >>= 2, ret += 2;
- return ret + (value >> 1);
-#endif
+ return 31 - clz32(value);
}
/* Find first bit starting from lsb */
static int ffs_bit(uint32_t value)
{
-#if QEMU_GNUC_PREREQ(3, 4)
- return __builtin_ffs(value) - 1;
-#else
- unsigned int ret = 0;
-
- if (!value)
- return 0;
- if (!(value & 0xffff))
- value >>= 16, ret = 16;
- if (!(value & 0xff))
- value >>= 8, ret += 8;
- if (!(value & 0xf))
- value >>= 4, ret += 4;
- if (!(value & 0x3))
- value >>= 2, ret += 2;
- if (!(value & 0x1))
- ret++;
- return ret;
-#endif
+ return ctz32(value);
}
static inline void set_bit(uint32_t *tab, int index)
reply other threads:[~2008-10-12 20:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=E1Kp7MD-0000c7-Kl@cvs.savannah.gnu.org \
--to=aurelien@aurel32.net \
--cc=qemu-devel@nongnu.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).