_hx_bit.lua 369 B

1234567891011
  1. -- require this for lua 5.1
  2. pcall(require, 'bit')
  3. if bit then
  4. _hx_bit = bit
  5. else
  6. local _hx_bit_raw = _G.require('bit32')
  7. _hx_bit = setmetatable({}, { __index = _hx_bit_raw });
  8. -- lua 5.2 weirdness
  9. _hx_bit.bnot = function(...) return _hx_bit_clamp(_hx_bit_raw.bnot(...)) end;
  10. _hx_bit.bxor = function(...) return _hx_bit_clamp(_hx_bit_raw.bxor(...)) end;
  11. end