From patchwork Thu Sep 12 11:17:09 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 274513 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 690ED2C03A9 for ; Thu, 12 Sep 2013 21:18:15 +1000 (EST) Received: from localhost ([::1]:41064 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VK4ub-0007w8-74 for incoming@patchwork.ozlabs.org; Thu, 12 Sep 2013 07:18:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40102) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VK4u1-0007km-UA for qemu-devel@nongnu.org; Thu, 12 Sep 2013 07:17:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VK4tw-0004zV-Em for qemu-devel@nongnu.org; Thu, 12 Sep 2013 07:17:37 -0400 Received: from mail-ea0-x232.google.com ([2a00:1450:4013:c01::232]:46021) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VK4tw-0004zD-6f for qemu-devel@nongnu.org; Thu, 12 Sep 2013 07:17:32 -0400 Received: by mail-ea0-f178.google.com with SMTP id a15so5275976eae.37 for ; Thu, 12 Sep 2013 04:17:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=urZCdBBHvzIbZAgvISIajVxPSTQGOBdhxPeymKqsmWs=; b=DTneS7hsTqHz4HMciFwSQveRn4WOttB0WZ4Tlp5k9wkSdMJ7wcHRmaz5/nJikkhEML shy3hYTs/O5DyAs/Rkr2Oz+x9MZK1smwVqi8G/6J7xujlsUnBLlpQibUADPWmjjd48eu xsEflKNj1f5Ny+6SBzZ9YrLYXM7TsMiqHMKTbXMnx11tOYhUvxE8jAWi401PS7EC8Gu4 HOxgdgjJsHVZaHLkTtyTNuL9eXNF0aLWDo1zTXiWkFojPJqn2s9hgGdAu5PLnXEVHmmE 9v3x3Re8Pm7BNIsFmLEsvbFs3zzF02P3Prq5S+tQEvtdURNQ3dKDazBZlqCtbyH4RTn0 /vbg== X-Received: by 10.15.107.10 with SMTP id ca10mr1776853eeb.76.1378984651495; Thu, 12 Sep 2013 04:17:31 -0700 (PDT) Received: from playground.lan (net-37-117-144-28.cust.dsl.vodafone.it. [37.117.144.28]) by mx.google.com with ESMTPSA id f49sm4970629eec.7.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 12 Sep 2013 04:17:30 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 12 Sep 2013 13:17:09 +0200 Message-Id: <1378984634-765-7-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1378984634-765-1-git-send-email-pbonzini@redhat.com> References: <1378984634-765-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c01::232 Cc: Peter Maydell Subject: [Qemu-devel] [PULL 06/11] hw/scsi/lsi53c895a: Use deposit32 rather than handcoded shift/mask X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Peter Maydell 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 Signed-off-by: Paolo Bonzini --- 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 a26b20b..5affc82 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); }