package flate
type fastEncL5 struct {
fastGen
table [tableSize]tableEntry
bTable [tableSize]tableEntryPrev
}
func ( *fastEncL5) ( *tokens, []byte) {
const (
= 12 - 1
= 1 + 1 +
= 4
)
for .cur >= bufferReset {
if len(.hist) == 0 {
clear(.table[:])
clear(.bTable[:])
.cur = maxMatchOffset
break
}
:= .cur + int32(len(.hist)) - maxMatchOffset
for := range .table[:] {
:= .table[].offset
if <= {
= 0
} else {
= - .cur + maxMatchOffset
}
.table[].offset =
}
for := range .bTable[:] {
:= .bTable[]
if .cur.offset <= {
.cur.offset = 0
.prev.offset = 0
} else {
.cur.offset = .cur.offset - .cur + maxMatchOffset
if .prev.offset <= {
.prev.offset = 0
} else {
.prev.offset = .prev.offset - .cur + maxMatchOffset
}
}
.bTable[] =
}
.cur = maxMatchOffset
}
:= .addBlock()
if len() < {
.n = uint16(len())
return
}
= .hist
:=
:= int32(len() - )
:= loadLE64(, )
for {
const = 6
const = 1
:=
var int32
var int32
for {
:= hashLen(, tableBits, )
:= hashLen(, tableBits, hashLongBytes)
=
= + + (-)>>
if > {
goto
}
:= .table[]
:= .bTable[]
:= loadLE64(, )
:= tableEntry{offset: + .cur}
.table[] =
:= &.bTable[]
.cur, .prev = , .cur
= hashLen(, tableBits, )
= hashLen(, tableBits, hashLongBytes)
= .cur.offset - .cur
if - < maxMatchOffset {
if uint32() == loadLE32(, ) {
.table[] = tableEntry{offset: + .cur}
:= &.bTable[]
.cur, .prev = tableEntry{offset: + .cur}, .cur
:= .prev.offset - .cur
if - < maxMatchOffset && uint32() == loadLE32(, ) {
= .matchLenLimited(int(+4), int(+4), ) + 4
:= .matchLenLimited(int(+4), int(+4), ) + 4
if > {
=
=
break
}
}
break
}
= .prev.offset - .cur
if - < maxMatchOffset && uint32() == loadLE32(, ) {
.table[] = tableEntry{offset: + .cur}
:= &.bTable[]
.cur, .prev = tableEntry{offset: + .cur}, .cur
break
}
}
= .offset - .cur
if - < maxMatchOffset && uint32() == loadLE32(, ) {
= .matchLenLimited(int(+4), int(+4), ) + 4
= .bTable[]
.table[] = tableEntry{offset: + .cur}
:= &.bTable[]
.cur, .prev = tableEntry{offset: + .cur}, .cur
:= .cur.offset - .cur
if - < maxMatchOffset {
if loadLE32(, ) == uint32() {
:= .matchLenLimited(int(+4), int(+4), ) + 4
if > {
=
=
=
break
}
}
= .prev.offset - .cur
if - < maxMatchOffset && loadLE32(, ) == uint32() {
:= .matchLenLimited(int(+4), int(+4), ) + 4
if > {
=
=
=
break
}
}
}
break
}
=
}
if == 0 {
= .matchLenLong(int(+4), int(+4), ) + 4
} else if == maxMatchLength {
+= .matchLenLong(int(+), int(+), )
}
if := + ; < 30 && < {
const = 2
:= .bTable[hashLen(loadLE64(, ), tableBits, hashLongBytes)].cur.offset
:= - .cur - +
:= +
:= -
if >= 0 && < maxMatchOffset && > 0 {
if := .matchLenLong(int(), int(), ); > {
=
=
=
}
}
}
for > 0 && > && [-1] == [-1] {
--
--
++
}
if < {
for , := range [:] {
.tokens[.n] = token()
.litHist[]++
.n++
}
}
.AddMatchLong(, uint32(--baseMatchOffset))
+=
=
if >= {
= + 1
}
if >= {
goto
}
const = 3
:= - + 1
if < -1 {
:= loadLE64(, )
:= tableEntry{offset: + .cur}
.table[hashLen(, tableBits, )] =
:= &.bTable[hashLen(, tableBits, hashLongBytes)]
.cur, .prev = , .cur
>>= 8
= tableEntry{offset: .offset + 1}
= &.bTable[hashLen(, tableBits, hashLongBytes)]
.cur, .prev = , .cur
>>= 8
= tableEntry{offset: .offset + 1}
.table[hashLen(, tableBits, )] =
+= 4
for ; < -1; += {
:= loadLE64(, )
:= tableEntry{offset: + .cur}
:= tableEntry{offset: .offset + 1}
:= &.bTable[hashLen(, tableBits, hashLongBytes)]
.cur, .prev = , .cur
.table[hashLen(>>8, tableBits, )] =
}
}
:= loadLE64(, -1)
:= .cur + - 1
:= hashLen(, tableBits, )
:= hashLen(, tableBits, hashLongBytes)
.table[] = tableEntry{offset: }
:= &.bTable[]
.cur, .prev = tableEntry{offset: }, .cur
= >> 8
}
:
if int() < len() {
if .n == 0 {
return
}
emitLiterals(, [:])
}
}