Skip to content

Commit

Permalink
hw/audio/intel-hda: Avoid shift into sign bit
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
pm215 authored and kraxel committed May 20, 2014
1 parent a2554a3 commit b1fe60c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hw/audio/intel-hda.c
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit b1fe60c

Please sign in to comment.