From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Kp7MI-0000nL-Vv for qemu-devel@nongnu.org; Sun, 12 Oct 2008 16:16:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Kp7MH-0000mH-7T for qemu-devel@nongnu.org; Sun, 12 Oct 2008 16:16:10 -0400 Received: from [199.232.76.173] (port=43564 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Kp7MH-0000mB-0C for qemu-devel@nongnu.org; Sun, 12 Oct 2008 16:16:09 -0400 Received: from savannah.gnu.org ([199.232.41.3]:44325 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Kp7MG-0000Wc-Sj for qemu-devel@nongnu.org; Sun, 12 Oct 2008 16:16:08 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1Kp7ME-0000cE-MK for qemu-devel@nongnu.org; Sun, 12 Oct 2008 20:16:07 +0000 Received: from aurel32 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1Kp7MD-0000c7-Kl for qemu-devel@nongnu.org; Sun, 12 Oct 2008 20:16:06 +0000 MIME-Version: 1.0 Errors-To: aurel32 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Aurelien Jarno Message-Id: Date: Sun, 12 Oct 2008 20:16:05 +0000 Subject: [Qemu-devel] [5469] hw/apic.c: use functions from host-utils.h Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 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)