lua-users home
lua-l archive

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


On Wed, Jul 10, 2013 at 11:14 AM, Philipp Janda <siffiejoe@gmx.net> wrote:
I usually use `val = val - mask` for this, meaning "clear all bits set in mask from val". I also use `a + b` for `a | b`, and `a( b )` for `!(b & ~a)` (i.e.: check if the set of one-bits in b is a subset of one-bits in a). Together with `==` this is enough to implement the common bit flags in C APIs.

Now this makes sense - why slavishy copy the C way of bit manipulation?

Such a library does not need any core changes, either.