[PATCH] rcu: shift 64-bit constant to avoid implicit 32 to 64 bit conversion
Morten Brørup
mb at smartsharesystems.com
Wed Nov 13 04:31:28 CET 2024
> From: Andre Muezerie [mailto:andremue at 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 at 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 at smartsharesystems.com>
More information about the dev
mailing list