mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-10-16 15:24:55 +02:00
Resolve "Merge the best from 7.40 branch"
This commit is contained in:
17
SabrehavenOTClient/modules/corelib/bitwise.lua
Normal file
17
SabrehavenOTClient/modules/corelib/bitwise.lua
Normal file
@@ -0,0 +1,17 @@
|
||||
Bit = {}
|
||||
|
||||
function Bit.bit(p)
|
||||
return 2 ^ p
|
||||
end
|
||||
|
||||
function Bit.hasBit(x, p)
|
||||
return x % (p + p) >= p
|
||||
end
|
||||
|
||||
function Bit.setbit(x, p)
|
||||
return Bit.hasBit(x, p) and x or x + p
|
||||
end
|
||||
|
||||
function Bit.clearbit(x, p)
|
||||
return Bit.hasBit(x, p) and x - p or x
|
||||
end
|
Reference in New Issue
Block a user