Last active
August 29, 2015 14:07
-
-
Save Python1320/e6b98867fc81735e96ba to your computer and use it in GitHub Desktop.
Hacky unsigned bitlib
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ubit=ubit or {} | |
local bit=bit | |
local ubit=ubit | |
function gen(name) | |
local f=bit[name] | |
if not f then error"?!?" end | |
local function func(...) | |
local ret = f(...) | |
return ret>=0 and ret or 0x100000000+ret | |
end | |
ubit[name] = func | |
bit['u'..name] = func | |
end | |
gen'rol' | |
gen'rshift' | |
gen'ror' | |
gen'bswap' | |
gen'bxor' | |
gen'bor' | |
gen'arshift' | |
gen'bnot' | |
gen'tobit' | |
gen'lshift' | |
gen'band' | |
ubit.tohex=bit.tohex |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment