Skip to content

Commit

Permalink
hw/scsi/lsi53c895a: Use deposit32 rather than handcoded shift/mask
Browse files Browse the repository at this point in the history
Use deposit32() rather than handcoded shifts/masks to update the
scratch registers. This is cleaner and incidentally avoids a clang
sanitizer complaint ("runtime error: left shift of 255 by 24 places
cannot be represented in type 'int'").

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
pm215 authored and bonzini committed Sep 12, 2013
1 parent 9279410 commit 57ffcc4
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions hw/scsi/lsi53c895a.c
Original file line number Diff line number Diff line change
Expand Up @@ -1870,8 +1870,7 @@ static void lsi_reg_writeb(LSIState *s, int offset, uint8_t val)
int shift;
n = (offset - 0x58) >> 2;
shift = (offset & 3) * 8;
s->scratch[n] &= ~(0xff << shift);
s->scratch[n] |= (val & 0xff) << shift;
s->scratch[n] = deposit32(s->scratch[n], shift, 8, val);
} else {
BADF("Unhandled writeb 0x%x = 0x%x\n", offset, val);
}
Expand Down

0 comments on commit 57ffcc4

Please sign in to comment.