From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MM8ou-0000tc-I6 for qemu-devel@nongnu.org; Wed, 01 Jul 2009 19:02:28 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MM8oq-0000hx-1a for qemu-devel@nongnu.org; Wed, 01 Jul 2009 19:02:28 -0400 Received: from [199.232.76.173] (port=56426 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MM8op-0000ho-V3 for qemu-devel@nongnu.org; Wed, 01 Jul 2009 19:02:23 -0400 Received: from mtaout01-winn.ispmail.ntl.com ([81.103.221.47]:23427) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MM8op-00017g-9q for qemu-devel@nongnu.org; Wed, 01 Jul 2009 19:02:23 -0400 Received: from aamtaout01-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout01-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20090701230219.CIOW6742.mtaout01-winn.ispmail.ntl.com@aamtaout01-winn.ispmail.ntl.com> for ; Thu, 2 Jul 2009 00:02:19 +0100 Received: from miranda.arrow ([213.107.24.213]) by aamtaout01-winn.ispmail.ntl.com (InterMail vG.2.02.00.01 201-2161-120-102-20060912) with ESMTP id <20090701230219.SZTL13254.aamtaout01-winn.ispmail.ntl.com@miranda.arrow> for ; Thu, 2 Jul 2009 00:02:19 +0100 Received: from sdb by miranda.arrow with local (Exim 4.63) (envelope-from ) id 1MM8oi-0003fJ-Oe for qemu-devel@nongnu.org; Thu, 02 Jul 2009 00:02:16 +0100 Date: Thu, 2 Jul 2009 00:02:16 +0100 From: Stuart Brady Subject: Re: [Qemu-devel] [PATCH v2] Use ffs in favor of ffsll Message-ID: <20090701230216.GA14043@miranda.arrow> References: <4A4BC57E.504@web.de> <4A4BC87A.6050005@web.de> <4A4BCD26.2060102@web.de> <20090701205802.GA11286@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090701205802.GA11286@codesourcery.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On Wed, Jul 01, 2009 at 01:58:02PM -0700, Nathan Froyd wrote: > On Wed, Jul 01, 2009 at 10:55:02PM +0200, Jan Kiszka wrote: > > - for (i = 0; i < ARRAY_SIZE(env->interrupt_bitmap); i++) { > > - bit = ffsll(env->interrupt_bitmap[i]); > > + for (i = 0; i < sizeof(env->interrupt_bitmap) / sizeof(int); i++) { > > + /* Note: This assumes little endian host, which is true in KVM mode. > > + In TCG mode it must be zero anyway. */ > > + bit = ffs(((int *)env->interrupt_bitmap)[i]); > > ISTR that some PPC hosts support KVM... FWIW, I notice we currently have a qemu_fls() defined in cutils.c, which uses the clz32() defined in host-utils.h. qemu_ffsll() could be implemented fairly easily in terms of ctz64(), although note that ffsll(n) == (ctz64(n) + 1) % 65. Cheers, -- Stuart Brady