[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Bitwise XOR in Lua?
- From: Reuben Thomas <rrt@...>
- Date: Mon, 9 Sep 2002 22:18:41 +0100 (BST)
> 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