Re: Bitwise XOR in Lua?
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Bitwise XOR in Lua?
- From: Roberto Ierusalimschy <roberto@...>
- Date: 2002年9月10日 09:34:29 -0300
> But de Morganising makes bor use four calls to band (three via bnot), so
> to avoid that I kept bor primitive.
You forgot the other "bunny" (whatever that means ;-):
> not A = -A - 1 (Paul Hsieh wrote that)
So, you have
function bor (a,b) return -band(-a-1, -b-1)-1 end
It's only one call!
-- Roberto