lua-users home
lua-l archive

Re: Bitwise XOR in Lua?

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


> 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

AltStyle によって変換されたページ (->オリジナル) /