DPDK patches and discussions
 help / color / mirror / Atom feed
From: Konstantin Ananyev <konstantin.ananyev@huawei.com>
To: Marat Khalili <marat.khalili@huawei.com>,
	"stephen@networkplumber.org" <stephen@networkplumber.org>,
	"jerinjacobk@gmail.com" <jerinjacobk@gmail.com>,
	"mb@smartsharesystems.com" <mb@smartsharesystems.com>,
	Jack Bond-Preston <jack.bond-preston@foss.arm.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, "stable@dpdk.org" <stable@dpdk.org>
Subject: RE: [PATCH v3 1/6] eal: variable first arguments of RTE_SHIFT_VALxx
Date: Fri, 19 Dec 2025 13:06:35 +0000	[thread overview]
Message-ID: <645dc8e37c2c4abc8b894362614d10ba@huawei.com> (raw)
In-Reply-To: <20251217180141.60227-2-marat.khalili@huawei.com>



> Macros RTE_SHIFT_VAL32 and RTE_SHIFT_VAL64 were implemented by applying
> UINT32_C or UINT64_C correspondingly to its first argument. As a
> consequence first argument had to be a constant. Replace UINT32_C and
> UINT64_C with casts to uint32_t and uint64_t to allow these arguments be
> variable. For constants the result should be the same.
> 
> (Yes, technically UINT64_C promotes to uint_least64_t, not uint64_t, but
> I think most users of RTE_SHIFT_VAL64 expect the result to be uint64_t.)
> 
> Signed-off-by: Marat Khalili <marat.khalili@huawei.com>
> Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
> ---
>  lib/eal/include/rte_bitops.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/lib/eal/include/rte_bitops.h b/lib/eal/include/rte_bitops.h
> index 2d1b9d281c..aa6ac73abb 100644
> --- a/lib/eal/include/rte_bitops.h
> +++ b/lib/eal/include/rte_bitops.h
> @@ -51,7 +51,7 @@ extern "C" {
>   * @param nr
>   *   The shift number in range of 0 to (32 - width of val).
>   */
> -#define RTE_SHIFT_VAL32(val, nr) (UINT32_C(val) << (nr))
> +#define RTE_SHIFT_VAL32(val, nr) ((uint32_t)(val) << (nr))
> 
>  /**
>   * Get the uint64_t shifted value.
> @@ -61,7 +61,7 @@ extern "C" {
>   * @param nr
>   *   The shift number in range of 0 to (64 - width of val).
>   */
> -#define RTE_SHIFT_VAL64(val, nr) (UINT64_C(val) << (nr))
> +#define RTE_SHIFT_VAL64(val, nr) ((uint64_t)(val) << (nr))
> 
>  /**
>   * Generate a contiguous 32-bit mask
> --

Acked-by: Konstantin Ananyev <konstantin.ananyev@huawei.com>

> 2.43.0


  reply	other threads:[~2025-12-19 13:06 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-10 15:30 [PATCH 0/3] bpf: simple tests and fixes Marat Khalili
2025-11-10 15:30 ` [PATCH 1/3] bpf: fix signed shift overflows in ARM JIT Marat Khalili
2025-11-11  6:25   ` Jerin Jacob
2025-11-11  7:53     ` Morten Brørup
2025-11-11 10:10     ` Marat Khalili
2025-11-11 16:29       ` Jerin Jacob
2025-11-11 16:31       ` Jerin Jacob
2025-11-11 16:39         ` Marat Khalili
2025-11-12  5:23           ` Jerin Jacob
2025-11-12 10:16             ` Marat Khalili
2025-11-10 15:30 ` [PATCH 2/3] bpf: disallow empty program Marat Khalili
2025-11-10 16:40   ` Stephen Hemminger
2025-11-10 16:46     ` Marat Khalili
2025-11-12 15:35   ` Konstantin Ananyev
2025-11-10 15:30 ` [PATCH 3/3] bpf: make add/subtract one program validate Marat Khalili
2025-11-12 15:37   ` Konstantin Ananyev
2025-12-16 18:20 ` [PATCH v2 0/5] bpf: simple tests and fixes Marat Khalili
2025-12-16 18:20   ` [PATCH v2 1/5] eal: variable first arguments of RTE_SHIFT_VALxx Marat Khalili
2025-12-17  9:25     ` Morten Brørup
2025-12-16 18:20   ` [PATCH v2 2/5] bpf: fix signed shift overflows in ARM JIT Marat Khalili
2025-12-17  9:49     ` Morten Brørup
2025-12-16 18:20   ` [PATCH v2 3/5] bpf: disallow empty program Marat Khalili
2025-12-18  0:54     ` Stephen Hemminger
2025-12-17  8:58       ` Marat Khalili
2025-12-16 18:20   ` [PATCH v2 4/5] bpf: make add/subtract one program validate Marat Khalili
2025-12-16 18:20   ` [PATCH v2 5/5] bpf: fix BPF validation w/ conditional jump first Marat Khalili
2025-12-17 18:01   ` [PATCH v3 0/6] bpf: simple tests and fixes Marat Khalili
2025-12-17 18:01     ` [PATCH v3 1/6] eal: variable first arguments of RTE_SHIFT_VALxx Marat Khalili
2025-12-19 13:06       ` Konstantin Ananyev [this message]
2025-12-17 18:01     ` [PATCH v3 2/6] bpf: fix signed shift overflows in ARM JIT Marat Khalili
2025-12-19 13:13       ` Konstantin Ananyev
2025-12-17 18:01     ` [PATCH v3 3/6] bpf: mark ARM opcodes with UINT32_C Marat Khalili
2025-12-19 13:14       ` Konstantin Ananyev
2025-12-17 18:01     ` [PATCH v3 4/6] bpf: disallow empty program Marat Khalili
2025-12-17 18:01     ` [PATCH v3 5/6] bpf: make add/subtract one program validate Marat Khalili
2025-12-17 18:01     ` [PATCH v3 6/6] bpf: fix BPF validation w/ conditional jump first Marat Khalili

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=645dc8e37c2c4abc8b894362614d10ba@huawei.com \
    --to=konstantin.ananyev@huawei.com \
    --cc=dev@dpdk.org \
    --cc=jack.bond-preston@foss.arm.com \
    --cc=jerinjacobk@gmail.com \
    --cc=marat.khalili@huawei.com \
    --cc=mb@smartsharesystems.com \
    --cc=stable@dpdk.org \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).