mirror of
https://github.com/minetest-mods/MoreMesecons.git
synced 2025-01-04 03:39:35 +01:00
refactor to_bits
This commit is contained in:
parent
332517912d
commit
858b23b28d
15
md5.lua
15
md5.lua
@ -100,15 +100,12 @@ else
|
|||||||
-- to bits table
|
-- to bits table
|
||||||
local tbl = {}
|
local tbl = {}
|
||||||
local cnt = 1
|
local cnt = 1
|
||||||
while (n > 0) do
|
local last
|
||||||
local last = math.mod(n,2)
|
while n > 0 do
|
||||||
if(last == 1) then
|
last = n % 2
|
||||||
tbl[cnt] = 1
|
tbl[cnt] = last
|
||||||
else
|
n = (n-last)/2
|
||||||
tbl[cnt] = 0
|
cnt = cnt + 1
|
||||||
end
|
|
||||||
n = (n-last)/2
|
|
||||||
cnt = cnt + 1
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return tbl
|
return tbl
|
||||||
|
Loading…
Reference in New Issue
Block a user