lua-users home
lua-l archive

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


>    A + B = (A and B)*2 + (A xor B)

So I made band primitive, and derived bxor and bnot.

>    So using deMorgan's laws you can get a simple relationship for "or" to.  Oh yes

But de Morganising makes bor use four calls to band (three via bnot), so
to avoid that I kept bor primitive.

Anyway, the logic stdlib is now updated accordingly. I've not added any 
efficiency measures on the grounds that they're harder to get right and 
produce larger Lua code; you might as well find a C compiler for bitlib 
instead!

-- 
http://www.mupsych.org/~rrt/ | Caution Children At Play Drive Slowly