vlc | branch: master | Hannes Domani <[email protected]> | Wed Jul 15 20:57:07 
2015 +0200| [0d4616beb40ac1d313acc9340231402698643fd5] | committer: 
Jean-Baptiste Kempf

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

Signed-off-by: Jean-Baptiste Kempf <[email protected]>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0d4616beb40ac1d313acc9340231402698643fd5
---

 share/lua/intf/modules/host.lua |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/share/lua/intf/modules/host.lua b/share/lua/intf/modules/host.lua
index b840b32..199325e 100644
--- a/share/lua/intf/modules/host.lua
+++ b/share/lua/intf/modules/host.lua
@@ -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()

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to