From b0cbe2a77ff1c12b72d2065d132fa51b79e48067 Mon Sep 17 00:00:00 2001 From: Marcos Kirsch Date: Fri, 13 Feb 2015 23:08:28 -0600 Subject: [PATCH] Fix for Lua builds without floating point. --- b64.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/b64.lua b/b64.lua index 33cdab0..99c1daa 100755 --- a/b64.lua +++ b/b64.lua @@ -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)