Messages in this thread | | | From | Andy Shevchenko <> | Date | Fri, 6 Nov 2020 18:06:04 +0200 | Subject | Re: [PATCH v1 1/3] vt: keyboard, use GENMAASK()/BIT() macros instead of open coded variants |
| |
On Fri, Nov 6, 2020 at 5:35 PM David Laight <David.Laight@aculab.com> wrote: > > From: Andy Shevchenko > > Sent: 06 November 2020 14:36 > > > > There are few places when GENMASK() or BIT() macro is suitable and makes code > > easier to understand. > > > ... > > - if ((d & ~0xff) == BRL_UC_ROW) { > > - if ((ch & ~0xff) == BRL_UC_ROW) > > + if ((d & ~GENMASK(7, 0)) == BRL_UC_ROW) { > > + if ((ch & ~GENMASK(7, 0)) == BRL_UC_ROW) > > return d | ch; > > Do you really think that makes it more readable?
Yes. Because this tells explicitly how many bits are used for metadata vs. data.
-- With Best Regards, Andy Shevchenko
| |