mirror of
https://github.com/xemu-project/xemu.git
synced 2025-01-22 11:54:47 +00:00
omap_intc: convert ffs(3) to ctz32() in omap_inth_sir_update()
Rewrite the loop using level &= level - 1 to clear the least significant bit after each iteration. This simplifies the loop and makes it easy to replace ffs(3) with ctz32(). Cc: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 1427124571-28598-8-git-send-email-stefanha@redhat.com Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
parent
c9d9331851
commit
41074f3d3f
@ -60,7 +60,7 @@ struct omap_intr_handler_s {
|
||||
|
||||
static void omap_inth_sir_update(struct omap_intr_handler_s *s, int is_fiq)
|
||||
{
|
||||
int i, j, sir_intr, p_intr, p, f;
|
||||
int i, j, sir_intr, p_intr, p;
|
||||
uint32_t level;
|
||||
sir_intr = 0;
|
||||
p_intr = 255;
|
||||
@ -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) {
|
||||
|
||||
while (level != 0) {
|
||||
i = ctz32(level);
|
||||
p = s->bank[j].priority[i];
|
||||
if (p <= p_intr) {
|
||||
p_intr = p;
|
||||
sir_intr = 32 * j + i;
|
||||
}
|
||||
f = ffs(level >> 1);
|
||||
level &= level - 1;
|
||||
}
|
||||
}
|
||||
s->sir_intr[is_fiq] = sir_intr;
|
||||
|
Loading…
x
Reference in New Issue
Block a user