DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Morten Brørup" <mb@smartsharesystems.com>
To: "Andre Muezerie" <andremue@linux.microsoft.com>,
	"Honnappa Nagarahalli" <honnappa.nagarahalli@arm.com>
Cc: <dev@dpdk.org>
Subject: RE: [PATCH] rcu: shift 64-bit constant to avoid implicit 32 to 64 bit conversion
Date: Wed, 13 Nov 2024 04:31:28 +0100	[thread overview]
Message-ID: <98CBD80474FA8B44BF855DF32C47DC35E9F8C9@smartserver.smartshare.dk> (raw)
In-Reply-To: <1731448959-18046-1-git-send-email-andremue@linux.microsoft.com>

> From: Andre Muezerie [mailto:andremue@linux.microsoft.com]
> Sent: Tuesday, 12 November 2024 23.03
> 
> ../lib/rcu/rte_rcu_qsbr.c(101): warning C4334: '<<': result of 32-bit
>  shift implicitly converted to 64 bits (was 64-bit shift intended?)
> ../lib/rcu/rte_rcu_qsbr.c(107): warning C4334: '<<': result of 32-bit
>  shift implicitly converted to 64 bits (was 64-bit shift intended?)
> ../lib/rcu/rte_rcu_qsbr.c(145): warning C4334: '<<': result of 32-bit
>  shift implicitly converted to 64 bits (was 64-bit shift intended?)
> 
> These warnings are being issued by the MSVC compiler. Since the result
> is
> being stored in a variable of type uint64_t, it makes sense to shift a
> 64-bit number instead of shifting a 32-bit number and then having the
> compiler to convert the result implicitly to 64 bits.
> UINT64_C was used in the fix as it is the portable way to define a 64-
> bit
> constant (ULL suffix is architecture dependent).
> 
> Signed-off-by: Andre Muezerie <andremue@linux.microsoft.com>
> ---

As far as I can see, this is also a bugfix:
(1 << id), where id = thread_id & 0x3f, was incorrect when thread_id > 0x1f.

Please add a Fixes tag, so backporting can be considered.

Reviewed-by: Morten Brørup <mb@smartsharesystems.com>


  parent reply	other threads:[~2024-11-13  3:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-12 22:02 Andre Muezerie
2024-11-13  3:12 ` Honnappa Nagarahalli
2024-11-13  3:31 ` Morten Brørup [this message]
2024-11-13 16:23 ` [PATCH v2] " 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=98CBD80474FA8B44BF855DF32C47DC35E9F8C9@smartserver.smartshare.dk \
    --to=mb@smartsharesystems.com \
    --cc=andremue@linux.microsoft.com \
    --cc=dev@dpdk.org \
    --cc=honnappa.nagarahalli@arm.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).