OSDN Git Service

hw/intc/xilinx_intc: Avoid shifting left into sign bit
authorPeter Maydell <peter.maydell@linaro.org>
Mon, 17 Mar 2014 16:00:40 +0000 (16:00 +0000)
committerMichael Tokarev <mjt@tls.msk.ru>
Thu, 27 Mar 2014 15:22:49 +0000 (19:22 +0400)
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>
hw/intc/xilinx_intc.c

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