Confusing numbering of flags & bits

Hi,

I'm currently looking at the spec in more details. I find it extremely
confusing that bit numbers for flags are shifted by one, for example :

   ACK (0x1):  Bit 1 being set indicates that this frame acknowledges...

Here I'm obviously tempted to define :

    #define ACK  BIT(1)

with a classical BIT(n)=(1<<(n)). But that's wrong since in fact it's
not bit 1 but bit 0. On some frames which define many flags, it's
easier to guess what's wrong, but on frames which define a single flag,
the mistake is very easy. I don't see any valid reason for numbering
bits in this very unusual way, so I'd suggest we fix this before the
release.

Regards,
Willy

Received on Saturday, 28 June 2014 08:53:07 UTC