Re: [PATCH v2] staging: rtl8723bs: Use % 4096 instead of & 0xfff

Andy Shevchenko <[email protected]> Sat, 5 Apr 2025 15:24:48 +0300
Newsgroups dev.linux.lists.outreachy,dev.linux.lists.linux-staging,org.kernel.vger.linux-kernel
Message-ID <CAHp75Vc0vOB1nDLrV+wmYeshxTsDwYq0xBkmJiOH=d5HONRpNQ@mail.gmail.com>
On Sat, Apr 5, 2025 at 11:23 AM Greg Kroah-Hartman
<[email protected]> wrote:
> On Sat, Apr 05, 2025 at 12:09:59AM +0000, Abraham Samuel Adekunle wrote:
> > Replace the bitwise AND operator `&` with a modulo
> > operator `%` and decimal number to make the upper limit visible
> > and clear what the semantic of it is.
>
> Eeek, no.  We all "know" what & means (it's a bit mask to handle the
> issues involved), and we all do NOT know that % will do the same thing
> at all.

And that is exactly the purpose of the change. The % 4096 makes it
clearer on what's going on, i.e. we are doing indexes that are wrapped
around the given number.

> So this just made things more difficult to maintain over time.
>
> What tool suggested this type of change to be made to this driver and
> these lines?

It's not a tool, it was me. I read the code and suggested that change.

-- 
With Best Regards,
Andy Shevchenko