Skip to content

Instantly share code, notes, and snippets.

@mebens
Created April 23, 2011 09:39
Show Gist options
  • Save mebens/938502 to your computer and use it in GitHub Desktop.
Save mebens/938502 to your computer and use it in GitHub Desktop.
Functions for quick left and right bitwise shifts in Lua.
function lshift(x, by)
return x * 2 ^ by
end
function rshift(x, by)
return math.floor(x / 2 ^ by)
end
@blackknight36
Copy link

Thanks. Not sure what I was thinking here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment