From nobody Fri Dec 19 04:29:42 2025 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1598607050; cv=none; d=zohomail.com; s=zohoarc; b=ldYfwM4ThBH6Czjd4OO1wylz44PWe5PekpRaT2dUzX1Mya0s3POk3Jet1GKTqvoYH6J/xGKUlqElWN08alD0u/QzW9hetg+/CEUqKqVTWRZUZzmfShm6nD5u7aeU9ervQOo70jlPM9x6YdwCayVDb0KXlyr6d9MzmxUhDKgmSe4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1598607050; h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=150vA2l0M0YAcbk3j/Ns9hH+mky1glijBmcJAoK7LV4=; b=MF7qz+Jbj15gXCi/y2X/MQqTH60DEQX1Z1grGlE/wwHZhRjlgLVz9mtU14PE0GNvfrJQVb1yqxuDX+ofX00tz3mQsMThmw9tWQe3Wn99ZOtYX5JCzc0Q2Anc/Fuu+nZfyLWfNetKesLer4N97UAqIm7ws6c997oNvZVsfWfFPRE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 15986070505691017.5460244617366; Fri, 28 Aug 2020 02:30:50 -0700 (PDT) Received: from localhost ([::1]:52146 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kBaif-0007OP-7e for importer@patchew.org; Fri, 28 Aug 2020 05:30:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46018) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kBaci-0004dJ-7I for qemu-devel@nongnu.org; Fri, 28 Aug 2020 05:24:40 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:40057) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kBacg-0004Kr-Fe for qemu-devel@nongnu.org; Fri, 28 Aug 2020 05:24:39 -0400 Received: by mail-wm1-x32e.google.com with SMTP id k20so269569wmi.5 for ; Fri, 28 Aug 2020 02:24:38 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id t13sm912304wru.65.2020.08.28.02.24.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Aug 2020 02:24:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=150vA2l0M0YAcbk3j/Ns9hH+mky1glijBmcJAoK7LV4=; b=wjRqha/nf8uDFBL0ZLylejYL/91TZQW0QPGa51XrOFO8Ibubv9oK2+z0laUCKPtfMU VCcxpdk3/6U4Mhkv6nH+HR1US4Ikd8p4Ueqm5BVu2sMFK/BCbW6eieEMXEPoGYPqYvWA pdhHmnFqspRg03SWs4NuBvHFRkjBsjSJ9AQu1x++rhbQ12WFn6IB0lfgtsLnJY0BX9ns 1YyfJ8fesVMx4Tl7nc3u/fq16frKt+vHZN3exQKEHTwkKBrtQ7bwy+G89z7pLLbg4G02 GKnB6Ag0KWy3R7CQ2oBmlms/FpF45kW9719BOYYAcI/Dam7iFv/ppIcqv2sWnNtK3tD0 PQxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=150vA2l0M0YAcbk3j/Ns9hH+mky1glijBmcJAoK7LV4=; b=SUEt5zsjL55pELJex5Cz6fDBwA6tNi2C37RJAzDvqdDeB9H5n4oChCzK0YW992nxR6 dvqLvOzGssWupeAOY9/EULiCQAhMZuoo+0zIShMHc6P+3JPL/dCT90Lo0kk1xJFvm6i1 ROm114cVAnEMYbvNj1QeIz030Ogzp6rxk9J7b8jN6sCHNVXfIvEluzPh5JLJcmYK2yUO FmvTHsobPHdq/d17JKUniI4V372H4lCgNUhaSVwYUaJDshn+tHjWiOK9CH9c0phRv7eh N3kShmt+jeM52YL/kadxSyWVSf5Ej38NaUIuq9TI/qSBq/PFgNYf7/FL56GsPKSh9Wo7 Z+PA== X-Gm-Message-State: AOAM531ER3kWEmIKFYz97eLxLui3KwWjgBUzCr/UYVl/NgE6Sc3stR/j Ag4tnfBK92JXGvGxYxXAJOLtikuN0anQ2uMT X-Google-Smtp-Source: ABdhPJwYE8vgjfrkdIKloMZmKVg0AdqzMOZ0MtBoYqYb9Xm62d0TrPDzetOCzdVSB8PTQIqH60nhgg== X-Received: by 2002:a1c:750f:: with SMTP id o15mr746980wmc.182.1598606676885; Fri, 28 Aug 2020 02:24:36 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 19/35] qemu/int128: Add int128_lshift Date: Fri, 28 Aug 2020 10:23:57 +0100 Message-Id: <20200828092413.22206-20-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200828092413.22206-1-peter.maydell@linaro.org> References: <20200828092413.22206-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) Content-Type: text/plain; charset="utf-8" From: Richard Henderson Add left-shift to match the existing right-shift. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Message-id: 20200815013145.539409-2-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- include/qemu/int128.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/include/qemu/int128.h b/include/qemu/int128.h index 5c9890db8b3..76ea405922d 100644 --- a/include/qemu/int128.h +++ b/include/qemu/int128.h @@ -63,6 +63,11 @@ static inline Int128 int128_rshift(Int128 a, int n) return a >> n; } =20 +static inline Int128 int128_lshift(Int128 a, int n) +{ + return a << n; +} + static inline Int128 int128_add(Int128 a, Int128 b) { return a + b; @@ -217,6 +222,17 @@ static inline Int128 int128_rshift(Int128 a, int n) } } =20 +static inline Int128 int128_lshift(Int128 a, int n) +{ + uint64_t l =3D a.lo << (n & 63); + if (n >=3D 64) { + return int128_make128(0, l); + } else if (n > 0) { + return int128_make128(l, (a.hi << n) | (a.lo >> (64 - n))); + } + return a; +} + static inline Int128 int128_add(Int128 a, Int128 b) { uint64_t lo =3D a.lo + b.lo; --=20 2.20.1