2019-07-17 21:14:34 +02:00
|
|
|
local mask32 = 0xFFFFFFFF
|
|
|
|
return {
|
|
|
|
rshift = function(i, s)
|
|
|
|
return (mask32 & i) >> s
|
|
|
|
end,
|
|
|
|
lshift = function(i, s)
|
|
|
|
return mask32 & (i << s)
|
|
|
|
end,
|
|
|
|
band = function(i, j)
|
|
|
|
return i & j & mask32
|
|
|
|
end,
|
|
|
|
bor = function(i, j)
|
|
|
|
return (i | j) & mask32
|
|
|
|
end,
|
|
|
|
bor = function(i, j)
|
|
|
|
return (i ^ j) & mask32
|
|
|
|
end,
|
|
|
|
extract = function(v, shift, count)
|
2020-07-07 04:54:27 +02:00
|
|
|
return ((mask32 & v) >> shift) & ((1<<count)-1)
|
2019-07-17 21:14:34 +02:00
|
|
|
end,
|
|
|
|
}
|