Re: [PATCH 0/6] Don't use BIT() macro in UAPI headers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


On Mon, May 24, 2021 at 12:46:26PM +0100, Christoph Hellwig wrote:
> On Thu, May 20, 2021 at 03:43:37AM -0700, Joe Richey wrote:
> > This patch series changes all UAPI uses of BIT() to just be open-coded.
> > However, there really should be a check for this in
> > Currently, the script actually _encourages_ users to use the BIT macro
> > even if adding things to UAPI.
> Yes.  In fact it should warn about BIT() in general.  It is totally
> pointless obsfucation that doesn't even save any typing at all.

That's not quite true; the point is that if you use BIT() consistently,
then even when you refer to bits 32 to 63 you won't accidentally
introduce shifts of more than the width of int, and the definition will
work equally well for assembly and C, which isn't true if you use `1UL`
in the definition.

With that in mind it's shorter and clearer than its functional

  (UL(1) << (x))

So IMO it's preferable to use BIT() generally, or _BITUL() in uapi


[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux