hw/intc/xilinx_intc: Avoid shifting left into sign bit

Avoid undefined behaviour shifting left into the sign bit.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
This commit is contained in:
Peter Maydell 2014-03-17 16:00:40 +00:00 committed by Michael Tokarev
parent 7d45e78401
commit 0bc60bd7b3

View File

@ -71,9 +71,10 @@ static void update_irq(struct xlx_pic *p)
/* Update the vector register. */ /* Update the vector register. */
for (i = 0; i < 32; i++) { for (i = 0; i < 32; i++) {
if (p->regs[R_IPR] & (1 << i)) if (p->regs[R_IPR] & (1U << i)) {
break; break;
} }
}
if (i == 32) if (i == 32)
i = ~0; i = ~0;