2 -- $Id: bitwise.lua,v 1.1 2005/02/22 02:54:32 cpressey Exp $
3 -- Package for (pure-Lua portable but extremely slow) bitwise arithmetic.
5 -- BEGIN lib/bitwise.lua --
11 local odd = function(x)
12 return x ~= math.floor(x / 2) * 2
17 Bitwise.bw_and = function(a, b)
19 while a > 0 or b > 0 do
20 if odd(a) and odd(b) then
30 Bitwise.bw_or = function(a, b)
32 while a > 0 or b > 0 do
33 if odd(a) or odd(b) then
43 -- END of lib/bitwise.lua --