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

Method initFast

s2/dict.go:276–296  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

274}
275
276func (d *Dict) initFast() {
277 d.fast.Do(func() {
278 const (
279 tableBits = 14
280 maxTableSize = 1 << tableBits
281 )
282
283 var table [maxTableSize]uint16
284 // We stop so any entry of length 8 can always be read.
285 for i := 0; i < len(d.dict)-8-2; i += 3 {
286 x0 := load64(d.dict, i)
287 h0 := hash6(x0, tableBits)
288 h1 := hash6(x0>>8, tableBits)
289 h2 := hash6(x0>>16, tableBits)
290 table[h0] = uint16(i)
291 table[h1] = uint16(i + 1)
292 table[h2] = uint16(i + 2)
293 }
294 d.fastTable = &table
295 })
296}
297
298func (d *Dict) initBetter() {
299 d.better.Do(func() {

Callers 1

encodeBlockDictGoFunction · 0.80

Calls 2

load64Function · 0.70
hash6Function · 0.70

Tested by

no test coverage detected