Lua库-bit32库

Global = Global or {};
local bits = {};


function bits.bxor(num1,num2)
    local ret=bit32.bxor(num1,num2);--异或
    return ret;
end


function bits.bor(num1,num2)
    local ret=bit32.bor(num1,num2);--
    return ret;
end


function bits.rshift(num,shiftbitnum)
    local ret=bit32.rshift(num,shiftbitnum);--右移
    return ret;
end

function bits.lshift(num,shiftbitnum)
    local ret=bit32.lshift(num,shiftbitnum);--左移
    return ret;
end

function bits.band(num1,num2)
    local ret=bit32.band(num1,num2);--
    return ret;
end

function bits.bnot(num1,num2)
    local ret=bit32.bnot(num1,num2);--取反
    return ret;
end


Global.bits = bits;
return bits;

 

posted @ 2016-09-29 11:41  风雨缠舟  阅读(10026)  评论(0编辑  收藏  举报