LuaJIT compatibility.

This commit is contained in:
jussi
2023-07-02 17:44:24 +03:00
parent 0e77452a1b
commit 8ad7254292
23 changed files with 966 additions and 53 deletions

View File

@@ -0,0 +1,23 @@
local bitlib = {}
function bitlib.setBit( v, i, b )
if b then
return v | 1 << i
else
return v & ~( 1 << i )
end
end
function bitlib.toggleBit( v, i )
return v ~ ( 1 << i )
end
function bitlib.getBit( v, i )
if v == nil then
return false
end
return v & ( 1 << i ) > 0
end
return bitlib