lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Am 25.10.19 um 23:02 schröbte Sergey Kovalev:
local bit32={}
bit32.extract=function(x,s,n) n=n or 1 return (x>>s)&((1<<n)-1) end
bit32.lshift=function(x,n) return x<<n end
bit32.bxor=function(a,b) return a~b end

The Lua test suite for Lua 5.3 contains a bit32 implementation in pure Lua using the bit operators.