Moshe Zadka wrote:

> OK, I want the first and fourth bit of a byte (cause the flags
> there matter to me, say) x&0x9 can be used, but x&0b1001 seems a
> bit clearer.

I prefer having flags defined..

/* Some hypotetical flags for a device called RTB */
#define RTB_FLAG_AAB    (1<<0)
#define RTB_FLAG_ON_OFF (1<<1)
#define RTB_FLAG_AAC    (1<<2)
#define RTB_FLAG_CCB    (1<<3)

And then compose the "binary" value using the flag names
    ZAP_FLAG_AAB | ZAP_FLAG_CCB

It is quite a bit more to write, but a lot easier to read a few weeks
later.

I use decimal, octal and hex when writing numbers, using the base that
the number was originally written/specified.

---
Henrik Nordström

Reply via email to