summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2013-08-23 17:16:33 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2013-09-12 08:46:21 +0200
commit57ffcc4c83331cb4b2639a866b6ecc11b3e7092c (patch)
tree4d75374bf316d50a2de9661348e1c1b397e07b7a /hw
parent927941059b95c3cc6264241115a23b1d14f1beb0 (diff)
downloadqemu-57ffcc4c83331cb4b2639a866b6ecc11b3e7092c.tar.gz
qemu-57ffcc4c83331cb4b2639a866b6ecc11b3e7092c.tar.bz2
qemu-57ffcc4c83331cb4b2639a866b6ecc11b3e7092c.zip
hw/scsi/lsi53c895a: Use deposit32 rather than handcoded shift/mask
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>
Diffstat (limited to 'hw')
-rw-r--r--hw/scsi/lsi53c895a.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
index a26b20b19e..5affc82d2b 100644
--- a/hw/scsi/lsi53c895a.c
+++ b/hw/scsi/lsi53c895a.c
@@ -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);
}