hw/ide/ahci.c: Avoid shift left into sign bit
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 28 Mar 2014 15:12:55 +0000 (15:12 +0000)
committerMichael Tokarev <mjt@tls.msk.ru>
Fri, 18 Apr 2014 06:33:36 +0000 (10:33 +0400)
Add U suffix to avoid shifting left into the sign bit, which
is undefined behaviour.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
hw/ide/ahci.c

index bfe633f3a5e3bf6824f5c88cbdca5c571f513d01..50327ffdf127e943af5e70da33a5921c0e56714f 100644 (file)
@@ -438,9 +438,9 @@ static void check_cmd(AHCIState *s, int port)
 
     if ((pr->cmd & PORT_CMD_START) && pr->cmd_issue) {
         for (slot = 0; (slot < 32) && pr->cmd_issue; slot++) {
-            if ((pr->cmd_issue & (1 << slot)) &&
+            if ((pr->cmd_issue & (1U << slot)) &&
                 !handle_cmd(s, port, slot)) {
-                pr->cmd_issue &= ~(1 << slot);
+                pr->cmd_issue &= ~(1U << slot);
             }
         }
     }