From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
Markus Armbruster <armbru@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PATCH v2 7/9] omap_intc: convert ffs(3) to ctz32() in omap_inth_sir_update()
Date: Tue, 17 Mar 2015 15:09:45 +0000 [thread overview]
Message-ID: <1426604987-11363-8-git-send-email-stefanha@redhat.com> (raw)
In-Reply-To: <1426604987-11363-1-git-send-email-stefanha@redhat.com>
The loop previously terminated on ffs(0) == 0, now it terminates on
ctz32(0) + 1 == 33.
Other than this change, ffs() is simply replaced with ctz32() + 1.
Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
hw/intc/omap_intc.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/hw/intc/omap_intc.c b/hw/intc/omap_intc.c
index ad3931c..0cf2d2d 100644
--- a/hw/intc/omap_intc.c
+++ b/hw/intc/omap_intc.c
@@ -72,14 +72,15 @@ static void omap_inth_sir_update(struct omap_intr_handler_s *s, int is_fiq)
for (j = 0; j < s->nbanks; ++j) {
level = s->bank[j].irqs & ~s->bank[j].mask &
(is_fiq ? s->bank[j].fiq : ~s->bank[j].fiq);
- for (f = ffs(level), i = f - 1, level >>= f - 1; f; i += f,
- level >>= f) {
+ for (f = ctz32(level) + 1, i = f - 1, level >>= f - 1;
+ f != 33;
+ i += f, level >>= f) {
p = s->bank[j].priority[i];
if (p <= p_intr) {
p_intr = p;
sir_intr = 32 * j + i;
}
- f = ffs(level >> 1);
+ f = ctz32(level >> 1) + 1;
}
}
s->sir_intr[is_fiq] = sir_intr;
--
2.1.0
next prev parent reply other threads:[~2015-03-17 15:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-17 15:09 [Qemu-devel] [PATCH v2 0/9] Convert ffs(3) to ctz32() Stefan Hajnoczi
2015-03-17 15:09 ` [Qemu-devel] [PATCH v2 1/9] bt-sdp: fix broken uuids power-of-2 calculation Stefan Hajnoczi
2015-03-17 15:09 ` [Qemu-devel] [PATCH v2 2/9] hw/arm/nseries: convert ffs(3) to ctz32() Stefan Hajnoczi
2015-03-17 15:09 ` [Qemu-devel] [PATCH v2 3/9] uninorth: " Stefan Hajnoczi
2015-03-17 15:09 ` [Qemu-devel] [PATCH v2 4/9] Convert (ffs(val) - 1) to ctz32(val) Stefan Hajnoczi
2015-03-17 15:09 ` [Qemu-devel] [PATCH v2 5/9] Convert ffs() != 0 callers to ctz32() Stefan Hajnoczi
2015-03-17 15:09 ` [Qemu-devel] [PATCH v2 6/9] sd: convert sd_normal_command() ffs(3) call " Stefan Hajnoczi
2015-03-17 15:09 ` Stefan Hajnoczi [this message]
2015-03-17 15:09 ` [Qemu-devel] [PATCH v2 8/9] os-win32: drop ffs(3) prototype Stefan Hajnoczi
2015-03-17 15:09 ` [Qemu-devel] [PATCH v2 9/9] checkpatch: complain about ffs(3) calls Stefan Hajnoczi
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=1426604987-11363-8-git-send-email-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=armbru@redhat.com \
--cc=peter.maydell@linaro.org \
--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).