|
On 19/11/2010 5.49, Miles Bader wrote:
Compare that to: local bor = bit.bor or bit32.bor -- prefer JIT-optimized ops local band = bit.band or bit32.band local bnot = bit.bnot or bit32.bnot ... if not t or bnot(bor(x,y)) == 1 and band(z,w) == 0 then ... end I think that's not only prettier, but much more clear as well: the "b" prefix makes the "bittiness" of the operations more obvious at a glance.
I heartily agree. Uppercase operands in Lua look weird (and confusing too because "or" and "OR" are quite different beasts).
If "band" etc. do not sound well (not a problem for me), there are always "bit.bitand" etc.
Finding good names is the hardest part of programming :-) Ah, the good old days when we had sex (meaning "sign extend" in the 68000)...
-- Enrico