qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v2] Use ffs in favor of ffsll


From: Stuart Brady
Subject: Re: [Qemu-devel] [PATCH v2] Use ffs in favor of ffsll
Date: Thu, 2 Jul 2009 00:02:16 +0100
User-agent: Mutt/1.5.13 (2006-08-11)

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]