module for bitwise operation transplanted and modified from lua-5.2.2