From 907bbd16552acd1cf089a5e2b05056f3357a55dc Mon Sep 17 00:00:00 2001 From: kikito Date: Mon, 6 Apr 2015 17:39:17 +0200 Subject: [PATCH] Remove unneeded locals --- md5.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/md5.lua b/md5.lua index 0ffa585..868e7b8 100644 --- a/md5.lua +++ b/md5.lua @@ -30,7 +30,6 @@ local md5 = { -- bit lib implementions -local floor, abs, max = math.floor, math.abs, math.max local char, byte, format, rep, sub = string.char, string.byte, string.format, string.rep, string.sub local bit_or, bit_and, bit_not, bit_xor, bit_rshift, bit_lshift @@ -80,7 +79,7 @@ else function bit_not(n) local tbl = to_bits(n) - local size = max(#tbl, 32) + local size = math.max(#tbl, 32) for i = 1, size do if(tbl[i] == 1) then tbl[i] = 0 @@ -95,7 +94,7 @@ else to_bits = function (n) if(n < 0) then -- negative - return to_bits(bit_not(abs(n)) + 1) + return to_bits(bit_not(math.abs(n)) + 1) end -- to bits table local tbl = {} @@ -169,10 +168,12 @@ else local high_bit = 0 if(n < 0) then -- negative - n = bit_not(abs(n)) + 1 + n = bit_not(math.abs(n)) + 1 high_bit = 2147483648 -- 0x80000000 end + local floor = math.floor + for i=1, bits do n = n/2 n = bit_or(floor(n), high_bit) @@ -183,7 +184,7 @@ else function bit_lshift(n, bits) if(n < 0) then -- negative - n = bit_not(abs(n)) + 1 + n = bit_not(math.abs(n)) + 1 end for i=1, bits do