From patchwork Mon Jun 24 13:14:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 807036 Delivered-To: patch@linaro.org Received: by 2002:a5d:508d:0:b0:362:4979:7f74 with SMTP id a13csp1878479wrt; Mon, 24 Jun 2024 06:18:43 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWSMXFD1mvhO4smOVDULH2wK6u9cch7ECOKzqMQdDPNq/ji4guCizEAwYCoW8ayR+qS4phezLyodZtYvtPRStTX X-Google-Smtp-Source: AGHT+IEMvUuBWTDzhy2uh05R22CUiKaUXs74//hRPRVfH+R3IxJGrg9yCLcs035yYlQFDvI9WB4E X-Received: by 2002:a05:620a:2951:b0:79b:eac1:52da with SMTP id af79cd13be357-79beac15353mr427671685a.16.1719235123647; Mon, 24 Jun 2024 06:18:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719235123; cv=none; d=google.com; s=arc-20160816; b=qOyXpWqvvImwwdlftYacLpdzgXdGMT1BmZaQdAPjHOacTTOhpc6aZTztUMjy/wjhFQ 8G7Uno6kMmikZPkUZIQwOiw0CExra+NSc0w0baqyB7LaQKfyNELxvalX/vA9pkY+gXFZ xcymok7H4j+rkux8bs78ePuBSgHMDhV1AwImdnegaEjDCE+2OBuE87YVA/lYJbt5vT7G 29xFLwVybe8VvjHNf7nnZ+Uz7hFkuIWyVmyv8yIyidgxz0E1+iaBUjlH/3h6y7T4OYJt jJasAXOUArRl51QA1mV3Tugxe1d5HRoDIDkYLhw1cX6/JZyTUREr2huqqjZotAniGYNV LKYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=7mJMievbUPjRodtOESUjRxIX72igzigbVmP1VpcJ+Qs=; fh=KlSE9ML5fZB/DxDOCqHNqoSGg+cM4CHFOUygk1jAoeY=; b=Stg+r7maE/r9LSD+lpQ5jObpBRNGo12CCAMSBeuiltrTiuijTwS90rHLbfjNQ7ADre SgmtpakHWZAEyvGAjAIgR05e+yT49PvOnVDIJY2UeSJnD9GS/XJnUlj4kKfZWVKFsOeP sKEGesixIC2nvFpRhmYANu4tYe107BghNoIptI9Im52uQ8XgznI/f3KGIGevXhQOXgbw d2hvQTBQGYIv5TnWhgeEWbwFVjBSuvWYHeRmFr2eUosYD8JZrR96sB7y3BIpb/3QXODG DqXB9BdQwASKyU2I5s2zRLcV9JC3CQ4QdXfpZhMNfEEvvDAp0pPs0CfuBlI0NIfqoVbo d2uQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AyLzsuEv; 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=pass (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 af79cd13be357-79bce882bbasi860055785a.36.2024.06.24.06.18.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 24 Jun 2024 06:18:43 -0700 (PDT) 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=pass header.i=@linaro.org header.s=google header.b=AyLzsuEv; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sLjX3-0001Lm-Ir; Mon, 24 Jun 2024 09:14:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sLjX2-0001Ld-6p for qemu-devel@nongnu.org; Mon, 24 Jun 2024 09:14:52 -0400 Received: from mail-lj1-x235.google.com ([2a00:1450:4864:20::235]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sLjX0-0004x3-Ke for qemu-devel@nongnu.org; Mon, 24 Jun 2024 09:14:51 -0400 Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2ec5fad1984so15556521fa.0 for ; Mon, 24 Jun 2024 06:14:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719234888; x=1719839688; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7mJMievbUPjRodtOESUjRxIX72igzigbVmP1VpcJ+Qs=; b=AyLzsuEvGwqKY+pNXiS6CKQuRD1FaJkYZ4FlJiCEg9DJss/XOAxVJix9cy8c41qifr J/obTuV8jwWhIRA3ONHYRWzTizYVGGfEbXj5716qV9Vxji7WPQSC9d3WYgYW6Gvmnvfa aY041ASuDB6KJfbASvDmZjeLt/Y6HzbF5iaPaJ6AGMNEmlP7qNiQt6y/p5wtbejrH1ih eiNXRJnV9ayr3+TkDw3JIcJGsWdgutyYJ0FAv+mTJk4olFERVqIsgyhFfFLtnE7MFTeA Q+L1sSTo+CGvIF5jQZWoV0ma6J61hL5RJvlHP9WHPfRM0ouFBbdRPP3aVsyjwvlmcvlF k2yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719234888; x=1719839688; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7mJMievbUPjRodtOESUjRxIX72igzigbVmP1VpcJ+Qs=; b=MMoR5cAXprJKP91uLAoQu7OS5ZTUNFVWqsvyZlodCEPoDcasOnnCrJU/1ugFTv2y7w 4Tzg+6hSZIg8kmd3qRR79w3zkm3Gv3RdQIg1Ddx9t9eb9dnPVloCc/A2hfX1gx51sQ0J xcEc0p7aMT+78Wk03xKrIF2u3VudR9gh75h+ug+GhFrLT/HYUy8vsb3IHDdY74lXomNg CGFpVEmrKdHEFpwBuX3Q7amiuEAfSDTBzKKR7/bMbveR/FFTT/SPKZz42cGTSKesYDna qMVeyp3vp+UgmyVLhr9JVtpurumUZhECGGoQef/1O9X9z54qq9BBEL/Z98uLE3IPzy6o aIqg== X-Gm-Message-State: AOJu0YzSQwscAboFnzuPsglkbIzj5E6a+v/h08hIt02HjhtMIa8xjVWm EIawNV2JnAAo9A8urAQntRJCKYvdMYg7LJdHbw4AfisTe7M2g4oLcr1GaoRGq3yefI+JrtG2BAp P X-Received: by 2002:a2e:918a:0:b0:2ec:4086:ea66 with SMTP id 38308e7fff4ca-2ec5b2fc27bmr38710701fa.4.1719234888511; Mon, 24 Jun 2024 06:14:48 -0700 (PDT) Received: from m1x-phil.lan (bd137-h02-176-184-46-22.dsl.sta.abo.bbox.fr. [176.184.46.22]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3663ada0bdesm10021016f8f.113.2024.06.24.06.14.47 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 24 Jun 2024 06:14:48 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?C?= =?utf-8?q?=C3=A9dric_Le_Goater?= , Richard Henderson Subject: [PULL 01/19] bswap: Add st24_be_p() to store 24 bits in big-endian order Date: Mon, 24 Jun 2024 15:14:22 +0200 Message-ID: <20240624131440.81111-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240624131440.81111-1-philmd@linaro.org> References: <20240624131440.81111-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::235; envelope-from=philmd@linaro.org; helo=mail-lj1-x235.google.com 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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Commit 14180d6221 ("bswap: Add the ability to store to an unaligned 24 bit field") added st24_le_p() for little endianness, add st24_be_p() equivalent for bit one. Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Cédric Le Goater Reviewed-by: Richard Henderson Message-Id: <20240621075607.17902-1-philmd@linaro.org> --- include/qemu/bswap.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h index bd67468e5e..ad22910a5d 100644 --- a/include/qemu/bswap.h +++ b/include/qemu/bswap.h @@ -38,12 +38,14 @@ static inline void bswap64s(uint64_t *s) #if HOST_BIG_ENDIAN #define be_bswap(v, size) (v) #define le_bswap(v, size) glue(__builtin_bswap, size)(v) +#define be_bswap24(v) (v) #define le_bswap24(v) bswap24(v) #define be_bswaps(v, size) #define le_bswaps(p, size) \ do { *p = glue(__builtin_bswap, size)(*p); } while (0) #else #define le_bswap(v, size) (v) +#define be_bswap24(v) bswap24(v) #define le_bswap24(v) (v) #define be_bswap(v, size) glue(__builtin_bswap, size)(v) #define le_bswaps(v, size) @@ -357,6 +359,11 @@ static inline void stw_be_p(void *ptr, uint16_t v) stw_he_p(ptr, be_bswap(v, 16)); } +static inline void st24_be_p(void *ptr, uint32_t v) +{ + st24_he_p(ptr, be_bswap24(v)); +} + static inline void stl_be_p(void *ptr, uint32_t v) { stl_he_p(ptr, be_bswap(v, 32));