From: Christoph Egger <Christoph.Egger@amd.com>
To: qemu-devel@nongnu.org
Cc: Blue Swirl <blauwirbel@gmail.com>,
Anthony Liguori <aliguori@us.ibm.com>,
Jan Kiszka <jan.kiszka@web.de>
Subject: Re: [Qemu-devel] Re: [PATCH] Use ffs in favor of ffsll
Date: Thu, 2 Jul 2009 10:39:08 +0200 [thread overview]
Message-ID: <200907021039.09082.Christoph.Egger@amd.com> (raw)
In-Reply-To: <f43fc5580907011327y513f19aes1de918a6bf40257e@mail.gmail.com>
On Wednesday 01 July 2009 22:27:51 Blue Swirl wrote:
> On 7/1/09, Jan Kiszka <jan.kiszka@web.de> wrote:
> > Not all host platforms support the ll variant. This is not a critical
> > path, so go the easy way.
> >
> > - 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++) {
> > + bit = ffs(((int *)env->interrupt_bitmap)[i]);
> > if (bit) {
> > - pending_irq = i * 64 + bit - 1;
> > + pending_irq = i * 8 * sizeof(int) + bit - 1;
>
> I think this will not work on a big endian host.
A qemu_ffsll() implementation can be something like this:
int qemu_ffsll(long long mask)
{
int bit;
bit = ffs((int)mask);
if (bit == 0) {
mask >>= 32;
bit = ffs((int)mask);
if (bit) bit += 32;
}
return bit;
}
Christoph
--
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Karl-Hammerschmidt-Str. 34, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Thomas M. McCoy, Giuliano Meroni
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632
prev parent reply other threads:[~2009-07-02 8:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-01 20:22 [Qemu-devel] [PATCH] Use ffs in favor of ffsll Jan Kiszka
2009-07-01 20:27 ` [Qemu-devel] " Blue Swirl
2009-07-01 20:35 ` Jan Kiszka
2009-07-01 20:55 ` [Qemu-devel] [PATCH v2] " Jan Kiszka
2009-07-01 20:58 ` Nathan Froyd
2009-07-01 22:24 ` [Qemu-devel] " Jan Kiszka
2009-07-01 23:02 ` [Qemu-devel] " Stuart Brady
2009-07-02 7:04 ` [Qemu-devel] [PATCH] Use ctz64 " Jan Kiszka
2009-07-02 7:11 ` [Qemu-devel] [PATCH v2] " Jan Kiszka
2009-07-03 9:35 ` Paul Brook
2009-07-04 7:16 ` Jan Kiszka
2009-07-02 8:39 ` Christoph Egger [this message]
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=200907021039.09082.Christoph.Egger@amd.com \
--to=christoph.egger@amd.com \
--cc=aliguori@us.ibm.com \
--cc=blauwirbel@gmail.com \
--cc=jan.kiszka@web.de \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.