Add Lua migration helper library for bitwise ops
see 49cd836e1
, #3485
put `bit = (require "migration_helpers").EmuHawk_pre_2_9_bit();` at top of file
can now easily add helpers for migrating from other emulators
This commit is contained in:
parent
cbb335fec2
commit
c7781d1c17
|
@ -0,0 +1,22 @@
|
|||
local helpers = {};
|
||||
helpers.EmuHawk_pre_2_9_bit = function()
|
||||
local wrapped_bit = {
|
||||
band = function(val, amt) return val & amt; end,
|
||||
bnot = function(val) return ~val; end,
|
||||
bor = function(val, amt) return val | amt; end,
|
||||
bxor = function(val, amt) return val ~ amt; end, -- not a typo
|
||||
lshift = function(val, amt) return val << amt; end,
|
||||
rol = bit.rol,
|
||||
ror = bit.ror,
|
||||
rshift = function(val, amt) return val >> amt; end,
|
||||
arshift = bit.arshift,
|
||||
check = bit.check,
|
||||
set = bit.set,
|
||||
clear = bit.clear,
|
||||
byteswap_16 = bit.byteswap_16,
|
||||
byteswap_32 = bit.byteswap_32,
|
||||
byteswap_64 = bit.byteswap_64,
|
||||
};
|
||||
return wrapped_bit;
|
||||
end;
|
||||
return helpers;
|
Loading…
Reference in New Issue