From fd745d623cf90e1318ad729bbeea3d32e170c48a Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Mon, 21 Feb 2022 18:55:50 +0100 Subject: [PATCH] polyfilled bit ops --- src/polyfill.lua | 54 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/src/polyfill.lua b/src/polyfill.lua index 4eed02b..7d2f084 100644 --- a/src/polyfill.lua +++ b/src/polyfill.lua @@ -13,10 +13,64 @@ _G.require = function (module) end else print("ERROR: Tell a dev to implement: " .. i) + os.exit() end end } setmetatable(module, metatable) return module end + print("ERROR: Tell a dev to implement: " .. module) + os.exit() +end + +-- Polyfill bit. see: http://bitop.luajit.org/api.html + +-- Already implemented +-- bit.band +-- bit.bnot +-- bit.bor +-- bit.bxor + +-- + +bit.tobit = function(x) + print("ERROR: Tell a dev to implement: bit.tobi") + os.exit() +end + +bit.tohex = function(x,n) + print("ERROR: Tell a dev to implement: bit.tohex") + os.exit() +end + +bit.lshift = function(x,n) + print("ERROR: Tell a dev to implement: bit.lshift") + os.exit() +end + + +bit.rshift = function(x,n) + print("ERROR: Tell a dev to implement: bit.rshift") + os.exit() +end + +bit.arshift = function(x,n) + -- TODO: this seems to easy. + return bit.brshift(x,n) +end + +bit.rol = function(x,n) + print("ERROR: Tell a dev to implement: bit.rol") + os.exit() +end + +bit.ror = function(x,n) + print("ERROR: Tell a dev to implement: bit.ror") + os.exit() +end + +bit.bswap = function(x) + print("ERROR: Tell a dev to implement: bit.bswap") + os.exit() end