MCPcopy
hub / github.com/klauspost/compress / ResetPrefix

Method ResetPrefix

zstd/enc_better.go:1099–1111  ·  view source on GitHub ↗
(prefix []byte)

Source from the content-addressed store, hash-verified

1097}
1098
1099func (e *betterFastEncoder) ResetPrefix(prefix []byte) {
1100 e.resetBasePrefix(prefix)
1101 if len(prefix) < 8 {
1102 return
1103 }
1104 end := e.cur + int32(len(prefix)) - 8
1105 for i := e.cur; i < end; i += 2 {
1106 cv := load6432(prefix, i-e.cur)
1107 h := hashLen(cv, betterLongTableBits, betterLongLen)
1108 e.longTable[h] = prevEntry{offset: i, prev: e.longTable[h].offset}
1109 e.table[hashLen(cv>>8, betterShortTableBits, betterShortLen)] = tableEntry{val: uint32(cv >> 8), offset: i + 1}
1110 }
1111}
1112
1113// ResetDict will reset and set a dictionary if not nil
1114func (e *betterFastEncoderDict) Reset(d *dict, singleBlock bool) {

Callers

nothing calls this directly

Calls 3

resetBasePrefixMethod · 0.80
load6432Function · 0.70
hashLenFunction · 0.70

Tested by

no test coverage detected