Received: from eggs.gnu.org ([2001:4830:134:3::10]:35337) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCu9r-0005uv-DN for qemu-devel@nongnu.org; Fri, 23 Aug 2013 12:24:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VCu9o-0001Oy-Eq for qemu-devel@nongnu.org; Fri, 23 Aug 2013 12:24:19 -0400 From: Peter Maydell Date: Fri, 23 Aug 2013 17:16:33 +0100 Message-Id: <1377274593-8797-3-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1377274593-8797-1-git-send-email-peter.maydell@linaro.org> References: <1377274593-8797-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PATCH 2/2] hw/scsi/lsi53c895a: Use deposit32 rather than handcoded shift/mask List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, Paolo Bonzini , patches@linaro.org 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 --- hw/scsi/lsi53c895a.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c index 333c62f..9c64e7c 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); } -- 1.7.9.5