Fix for Lua builds without floating point.

This commit is contained in:
Marcos Kirsch 2015-02-13 23:08:28 -06:00
parent d137648706
commit b0cbe2a77f

View File

@ -3,7 +3,6 @@
-- compatible with lua 5.1
-- http://www.it-rfc.de
-- licensed under the terms of the LGPL2
--module('b64', package.seeall)
b64 = {}
@ -15,7 +14,9 @@ end
-- shift right
local function rsh(value,shift)
return math.floor(value/2^shift) % 256
-- Lua builds with no floating point don't define math.
if math then return math.floor(value/2^shift) % 256 end
return (value/2^shift) % 256
end
-- return single bit (for OR)