Skip to content

Commit fd677d1

Browse files
committed
Comments and formatting.
1 parent a0b0ac6 commit fd677d1

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

arch/INFLATE.LUA

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function inflate(r, w, z)
6666
-- kg = keep going (in a loop)
6767
-- sw = sliding window (32/64KB buffer)
6868
-- wp = window pointer
69-
-- o = output chunk buffer
69+
-- o = output chunk buffer
7070
local bs, op, kg, sw, wp, o = nbs(r), 0, 1, {}, 0, {}
7171

7272
---Flush all unwritten data to the output file
@@ -173,7 +173,13 @@ function inflate(r, w, z)
173173
for _ = 1, l do ab(bs.r(8)) end -- copy raw data
174174

175175
elseif t == 1 or t == 2 then
176+
177+
-- ll = literal length
178+
-- dl = distance length
179+
-- h = huffman
180+
-- d = distances
176181
local ll, dl, h, d = {}, {}
182+
177183
if t == 1 then
178184
-- fixed Huffman
179185
for _ = 0, 143 do ll[#ll+1] = 8 end
@@ -231,8 +237,10 @@ function inflate(r, w, z)
231237
"\1\0\0\0\2\0\0\0\3\0\0\0\4\0\0\0\5\0\0\0\7\0\0\0\9\0\0\0\13\0\0\0\17\0\0\0\25\0\0\0\33\0\0\0\49\0\0\0\65\0\0\0\97\0\0\0\129\0\0\0\193\0\0\0\1\1\0\0\129\1\0\0\1\2\0\0\1\3\0\0\1\4\0\0\1\6\0\0\1\8\0\0\1\12\0\0\1\16\0\0\1\24\0\0\1\32\0\0\1\48\0\0\1\64\0\0\1\96\0\0\1\128\0\0\1\192\0\0\1\0\1\0\1\128\1\0\1\0\2\0\1\128\2\0\1\0\4\0\1\128\4\0\1\0\8\0\1\128\8\0\1\0\16\0\1\128\16\0\1\0\32\0\1\128\32\0\1\0\64\0\1\128\64\0\1\0\128\0\1\128\128\0\1\0\0\1\1\128\0\1\1\0\0\2\1\128\0\2\1\0\0\4\1\128\0\4\1\0\0\8\1\128\0\8\1\0\0\16\1\128\0\16\1\0\0\32\1\128\0\32\1\0\0\64\1\128\0\64\1\0\0\128\1\128\0\128\1\0\0\0\192"
232238

233239
while true do
240+
234241
-- s = sym
235242
local s = rh(h)
243+
236244
if s < 256 then
237245
ab(s)
238246
elseif s == 256 then
@@ -244,9 +252,9 @@ function inflate(r, w, z)
244252
-- a = add
245253
-- l = length
246254
local li, b, x, l = (s - 257) * 2 + 1
255+
247256
b, x = lex:byte(li), lex:byte(li + 1)
248257
if s == 285 then b = 258 end
249-
250258
l = b + (x > 0 and bs.r(x) or 0)
251259

252260
if d.max > 0 and #d.tab > 0 then

0 commit comments

Comments
 (0)