From patchwork Tue Feb 18 19:39:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 183615 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp6488953ile; Tue, 18 Feb 2020 11:43:21 -0800 (PST) X-Google-Smtp-Source: APXvYqzUgZzV4MT2szHYtopBcyM8q2+QHIkv0hltz982+vvbI3qpRADS4v50vbC6Ot51Tz7jixFz X-Received: by 2002:a05:620a:9cc:: with SMTP id y12mr20296486qky.446.1582055001451; Tue, 18 Feb 2020 11:43:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582055001; cv=none; d=google.com; s=arc-20160816; b=Z35CWuu+RW6sOttAOUBKwRg+31rPQMQSZTO68DFtkOBM0TD8In83qUGjBnPCHhai5+ /8mnz2OgSG5pnhyNltSN7F/LxfyXZ/4DMaXa64meCrF4pCD9nAGJqp2SvS4dgbHV1OXA YfuexNfTr94y37fyhyqPp6GIFHlvRietc2DZj4eKv5/BsDoEDjtami6HX4W3og39SqAP /1bc36Z7V0aXxDQnZ3IKcPqYuEZNZblufOMMay7ZBm3MiHvN0BnRGA+SQEqSGfZTnMdo kEbo5H7at0L0PF8+LCH3HzXSoNbdyzWBa0EpdB1nz89FvNk29imCecDSKbJmvExPN4/j FX7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=UwMVy3DhT2jUtkg7ZPdWAKnQO+6DWfWffPjgYExKp2o=; b=NZ3s6/9mTMnPnJqr1n4+v+7wF6imrhDMgEQi0nKybjrfaWZNK4Kng9f6j60/JjCUGK yXtnET2WI3c2LSQ8pKs8fZABtY0ig+QrLgYuNFpyMfWJVywnAd4sma+efU3iOLteRzaN Smlbkdhi1ElIFzfcSxLUtDgitklQyUpFOaA+gMtXHNoHxB61Zk6HhYYbxv0Md5AI3iy9 M+Ecyysoetyj9Hc2Z4w8kJE05zQrLib1Bowcwtj6WNdHDa5TlxbSn7oxulKD7mQx+c6Y Dd1ykFvy6fVeKSOexbGZWJb53JFtiTCpkV1PCDf6b2UMUCQIyaxAbjP2oddJEXUl4zUD zrBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=USz99uwm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 191si2435440qkl.67.2020.02.18.11.43.21 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 18 Feb 2020 11:43:21 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=USz99uwm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:41120 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j48m8-0001TM-W8 for patch@linaro.org; Tue, 18 Feb 2020 14:43:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54965) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j48iX-0003Za-UO for qemu-devel@nongnu.org; Tue, 18 Feb 2020 14:39:38 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j48iW-0004Id-VP for qemu-devel@nongnu.org; Tue, 18 Feb 2020 14:39:37 -0500 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]:43521) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j48iW-0004HA-P8 for qemu-devel@nongnu.org; Tue, 18 Feb 2020 14:39:36 -0500 Received: by mail-pg1-x534.google.com with SMTP id u12so11079556pgb.10 for ; Tue, 18 Feb 2020 11:39:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UwMVy3DhT2jUtkg7ZPdWAKnQO+6DWfWffPjgYExKp2o=; b=USz99uwmXbaCrCFCIdZdP+xafQVcgC6G98Bq9WZr7x1asRBL5IjEieOMIxYsGBarDR RWr1c2bUsWvCsjuvhg/nt8MzYfcmwmAIHKXsUDbVjQpjAbDx49WIDb2Wa4C4gwcK0F2t cn8iBQkkDOsDBoBADfA2Efu40UmlE2mGaIdx+/BCSadlAFYkSolKViTwfgh23LzMqFKr 4sCpKl5Q/eYBAzbcuigEbM4/49/WJLSwdZ67U4XHIl74uh8zlWNcVgZ2alp4OBWtf/5p KcRi/283uE1vpmLIFwQD9MkWJf0vZfFdD8ut1QG4kofFsq7dou1NMTL3WqCCRS2/cVZg HUJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UwMVy3DhT2jUtkg7ZPdWAKnQO+6DWfWffPjgYExKp2o=; b=gkjpAV3K6GFOWoeU3FO/n19RJj+QR5DoOpAdyfctJ7z1nTAVORyqgiOi0XN2H8aQ0s VvUw70J0zMJYuC7Ps3hAx8OPThFIYoKECiapjyDb1Kv/2e3WsvsBij+1KuuBMGjU/5wu YtaO0nwOE0m4ESS4pajy+EKsdXdStLP+44J8XDzganesaxlx5+60awfDcJjQE8LzYBik lBB8mjQLLZBnLHnPaUsraRxWZMHJxy1RBPcyLU+XISt7rie+H4t5zpnbBFsnlHuhtSX1 C+IIc4NxFwb+g/YbvnXjhL2rjRfILbi3A2U6GjkdLiRbBTM1Ebr+/Gk1c+u4bkHPdJZi LKgg== X-Gm-Message-State: APjAAAXuSny9ImHaGRPsdiJM4r/yF0CTtkjqEeriCOh7/S11S97xiKpC TRm5rXL3DC6V+FhYYBE1HG337C3FT3c= X-Received: by 2002:a63:d207:: with SMTP id a7mr24561623pgg.225.1582054775469; Tue, 18 Feb 2020 11:39:35 -0800 (PST) Received: from localhost.localdomain (97-126-123-70.tukw.qwest.net. [97.126.123.70]) by smtp.gmail.com with ESMTPSA id y15sm424395pgj.78.2020.02.18.11.39.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Feb 2020 11:39:34 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 3/9] hw/display/artist: Delay some variables initialization Date: Tue, 18 Feb 2020 11:39:23 -0800 Message-Id: <20200218193929.11404-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200218193929.11404-1-richard.henderson@linaro.org> References: <20200218193929.11404-1-richard.henderson@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::534 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, Sven Schnelle , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé We want to have an early exit path. Delay some initializations before the variables are used. Signed-off-by: Philippe Mathieu-Daudé Acked-by: Sven Schnelle Message-Id: <20200214001303.12873-4-f4bug@amsat.org> Signed-off-by: Richard Henderson --- hw/display/artist.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) -- 2.20.1 diff --git a/hw/display/artist.c b/hw/display/artist.c index 47f0e9f0bc..97c811b35e 100644 --- a/hw/display/artist.c +++ b/hw/display/artist.c @@ -558,7 +558,7 @@ static void draw_line(ARTISTState *s, int x1, int y1, int x2, int y2, bool update_start, int skip_pix, int max_pix) { struct vram_buffer *buf; - uint8_t color = artist_get_color(s); + uint8_t color; int dx, dy, t, e, x, y, incy, diago, horiz; bool c1; uint8_t *p; @@ -569,10 +569,6 @@ static void draw_line(ARTISTState *s, int x1, int y1, int x2, int y2, s->vram_start = (x2 << 16) | y2; } - buf = &s->vram_buffer[ARTIST_BUFFER_AP]; - - c1 = false; - if (x2 > x1) { dx = x2 - x1; } else { @@ -583,6 +579,8 @@ static void draw_line(ARTISTState *s, int x1, int y1, int x2, int y2, } else { dy = y1 - y2; } + + c1 = false; if (dy > dx) { t = y2; y2 = x2; @@ -620,6 +618,8 @@ static void draw_line(ARTISTState *s, int x1, int y1, int x2, int y2, } x = x1; y = y1; + color = artist_get_color(s); + buf = &s->vram_buffer[ARTIST_BUFFER_AP]; do { if (c1) {