Re: [PATCH net-next] net: lan966x: Fix lan966x_ifh_get
From: Jakub Kicinski
Date: Fri Apr 14 2023 - 21:28:57 EST
On Fri, 14 Apr 2023 19:00:20 +0200 Alexander Lobakin wrote:
> > @@ -608,6 +608,7 @@ static u64 lan966x_ifh_get(u8 *ifh, size_t pos, size_t length)
> > val |= (1 << i);
>
> Alternatively, you can change that to (pick one that you like the most):
>
> val |= 1ULL << i;
> // or
> val |= BIT_ULL(i);
// or
(u64)1 << i
// or, since you're only concerned about sign extension, even
1U << i
having the correct type of the lval seems cleaner than masking, indeed.