DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Andre Muezerie <andremue@linux.microsoft.com>
Cc: dev <dev@dpdk.org>, "Medvedkin, Vladimir" <vladimir.medvedkin@intel.com>
Subject: Re: [PATCH v5 1/2] lib/fib: remove warning about implicit 64-bit conversion
Date: Sat, 17 May 2025 20:09:32 +0900	[thread overview]
Message-ID: <CAOaVG15FDQTGgtA6VkqGMR1A=DwXvTYGGGcxDrNQrtqjxZxxhg@mail.gmail.com> (raw)
In-Reply-To: <1747428335-3736-2-git-send-email-andremue@linux.microsoft.com>

[-- Attachment #1: Type: text/plain, Size: 1266 bytes --]

Ok.
Wonder if RTE_PTR_ADD should have the cast there instead

On Sat, May 17, 2025, 05:45 Andre Muezerie <andremue@linux.microsoft.com>
wrote:

> MSVC issues the warning below:
>
> ../lib/fib/trie.c(341): warning C4334: '<<':
> result of 32-bit shift implicitly converted to 64 bits
> (was 64-bit shift intended?)
>
> The fix is to cast (1) explicitly to uintptr_t since it is used
> in pointer arithmetic.
>
> Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
> ---
>  lib/fib/trie.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/lib/fib/trie.c b/lib/fib/trie.c
> index 6c20057ac5..24a08b827d 100644
> --- a/lib/fib/trie.c
> +++ b/lib/fib/trie.c
> @@ -338,7 +338,7 @@ write_edge(struct rte_trie_tbl *dp, const uint8_t
> *ip_part, uint64_t next_hop,
>                 if (ret < 0)
>                         return ret;
>                 if (edge == LEDGE) {
> -                       write_to_dp((uint8_t *)p + (1 << dp->nh_sz),
> +                       write_to_dp(RTE_PTR_ADD(p, (uintptr_t)(1) <<
> dp->nh_sz),
>                                 next_hop << 1, dp->nh_sz, UINT8_MAX -
> *ip_part);
>                 } else {
>                         write_to_dp(get_tbl_p_by_idx(dp->tbl8, tbl8_idx *
> --
> 2.49.0.vfs.0.3
>
>

[-- Attachment #2: Type: text/html, Size: 1914 bytes --]

  parent reply	other threads:[~2025-05-17 11:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-04  2:56 [PATCH] " Andre Muezerie
2024-12-04 22:59 ` Stephen Hemminger
2024-12-05 15:34   ` Andre Muezerie
2024-12-05 15:38 ` [PATCH v2] " Andre Muezerie
2025-03-03 22:54 ` [PATCH v3] " Andre Muezerie
2025-03-04  6:49   ` Stephen Hemminger
2025-03-04 16:51     ` Andre Muezerie
2025-03-04 10:47   ` Bruce Richardson
2025-03-04 16:52     ` Andre Muezerie
2025-03-04 16:48 ` [PATCH v4] " Andre Muezerie
2025-05-16 20:45 ` [PATCH v5 0/2] enable fib to be compiled with MSVC Andre Muezerie
2025-05-16 20:45   ` [PATCH v5 1/2] lib/fib: remove warning about implicit 64-bit conversion Andre Muezerie
2025-05-17 10:07     ` Morten Brørup
2025-05-17 11:09     ` Stephen Hemminger [this message]
2025-05-17 12:59       ` Morten Brørup
2025-05-16 20:45   ` [PATCH v5 2/2] lib/fib: enable fib to be compiled with MSVC Andre Muezerie

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='CAOaVG15FDQTGgtA6VkqGMR1A=DwXvTYGGGcxDrNQrtqjxZxxhg@mail.gmail.com' \
    --to=stephen@networkplumber.org \
    --cc=andremue@linux.microsoft.com \
    --cc=dev@dpdk.org \
    --cc=vladimir.medvedkin@intel.com \
    /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).