hw/audio/intel-hda: Avoid shift into sign bit
authorPeter Maydell <peter.maydell@linaro.org>
Fri, 9 May 2014 13:22:53 +0000 (14:22 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 20 May 2014 06:49:21 +0000 (08:49 +0200)
Add a U suffix to avoid shifting into the sign bit (which is
undefined behaviour in C).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/audio/intel-hda.c

index 9e075c01373bea17daa9f5339e6bc5a3c638c6b1..3cfb66c5d81218f75accf604709bfc2d77683b99 100644 (file)
@@ -245,7 +245,7 @@ static void intel_hda_update_int_sts(IntelHDAState *d)
 
     /* update global status */
     if (sts & d->int_ctl) {
-        sts |= (1 << 31);
+        sts |= (1U << 31);
     }
 
     d->int_sts = sts;
@@ -257,7 +257,7 @@ static void intel_hda_update_irq(IntelHDAState *d)
     int level;
 
     intel_hda_update_int_sts(d);
-    if (d->int_sts & (1 << 31) && d->int_ctl & (1 << 31)) {
+    if (d->int_sts & (1U << 31) && d->int_ctl & (1U << 31)) {
         level = 1;
     } else {
         level = 0;