Files
ets-module-collection/AIO_Server/bit53.lua
2024-02-08 18:34:50 -05:00

30 lines
816 B
Lua

-- Provides compatibility for scripts using bit libs for lua versions < 5.3
-- Using load to avoid errors when having this file in earlier lua sources than 5.3
-- check that lua version is higher or equal to 5.3
local MIN_LUA_VER = 5.3
if tonumber(_VERSION:match("%d+%.?%d*")) >= MIN_LUA_VER then
return assert(assert(load( [[
local bit53 = {}
function bit53.band(a,b)
return a&b
end
function bit53.bor(a,b)
return a|b
end
function bit53.bxor(a,b)
return a~b
end
function bit53.bnot(a)
return ~a
end
function bit53.lshift(a, b)
return a<<b
end
function bit53.rshift(a, b)
return a>>b
end
return bit53
]], "bit53" ))())
end