to get x=y<<by you simply use
Code: Select all
x=y*2^by
Code: Select all
x=floor(y/2^by)
Code: Select all
x=y*2^by
Code: Select all
x=floor(y/2^by)
BlackBulletIV wrote:I've found a way to simulate the bitwise shift operators in Lua, by just using some simple mathematics. I've posted a blog post about it, so I'll direct you to there for details. But for those who don't want to read a few paragraphs, here's a couple lines of code that should help:Code: Select all
number * 2 ^ leftShiftValue -- same as number << leftShiftValue math.floor(number / 2 ^ rightShiftValue) -- same as number >> rightShiftValue
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 6 guests