Commit 0d4616be authored by ssbssa's avatar ssbssa Committed by Jean-Baptiste Kempf
Browse files

lua: do a binary-and operation in is_flag_set()


Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <jb@videolan.org>
parent ac7e457d
......@@ -68,7 +68,14 @@ status = { init = 0, read = 1, write = 2, password = 3 }
client_type = { net = 1, stdio = 2, fifo = 3, telnet = 4 }
function is_flag_set(val, flag)
return (((val - (val % flag)) / flag) % 2 ~= 0)
local bit = 65536
while bit > 1 do
val = val % bit
flag = flag % bit
bit = bit / 2
if val >= bit and flag >= bit then return true end
end
return false
end
function host()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment