From: Andre Muezerie <andremue@linux.microsoft.com>
To: Bruce Richardson <bruce.richardson@intel.com>
Cc: dev@dpdk.org, vladimir.medvedkin@intel.com
Subject: Re: [PATCH v3] lib/fib: remove warning about implicit 64-bit conversion
Date: Tue, 4 Mar 2025 08:52:50 -0800 [thread overview]
Message-ID: <20250304165250.GB21599@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> (raw)
In-Reply-To: <Z8baQLYFo9Fev_HG@bricha3-mobl1.ger.corp.intel.com>
On Tue, Mar 04, 2025 at 10:47:28AM +0000, Bruce Richardson wrote:
> On Mon, Mar 03, 2025 at 02:54:52PM -0800, Andre Muezerie 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 the result 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 4893f6c636..bf9f63eaa2 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((uint8_t *)p + (uintptr_t)(1 << dp->nh_sz),
>
> Might be worth considering using the RTE_PTR_ADD macro too for this line.
Makes sense. I'm using RTE_PTR_ADD in v4.
Thanks for the suggestion.
>
> /Bruce
next prev parent reply other threads:[~2025-03-04 16:52 UTC|newest]
Thread overview: 10+ 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 [this message]
2025-03-04 16:48 ` [PATCH v4] " 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=20250304165250.GB21599@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net \
--to=andremue@linux.microsoft.com \
--cc=bruce.richardson@intel.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).