()
| 274 | } |
| 275 | |
| 276 | func (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 | |
| 298 | func (d *Dict) initBetter() { |
| 299 | d.better.Do(func() { |
no test coverage detected