Commit 0d4616be authored by Hannes Domani's avatar Hannes Domani Committed by Jean-Baptiste Kempf

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

Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent ac7e457d
...@@ -68,7 +68,14 @@ status = { init = 0, read = 1, write = 2, password = 3 } ...@@ -68,7 +68,14 @@ status = { init = 0, read = 1, write = 2, password = 3 }
client_type = { net = 1, stdio = 2, fifo = 3, telnet = 4 } client_type = { net = 1, stdio = 2, fifo = 3, telnet = 4 }
function is_flag_set(val, flag) 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 end
function host() 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