Lua_BitOps - beyond-all-reason/springrts_engine_wiki_mirror GitHub Wiki

Development < Lua Scripting <

Bit Operators

-- Note: there are no bit shift. Use those Lua functions instead for 24 bits bitshift -- 24 bits because only the 24 bits of the mantissa can be easily used in a 32 bit float -- bitshift functions (<<, >> equivalent)

-- shift left local function lsh(value,shift)     return (value*(2^shift)) % 2^24 end

-- shift right local function rsh(value,shift)     return math.floor(value/2^shift) % 2^24 end

category: Lua

⚠️ **GitHub.com Fallback** ⚠️