@@ -67,7 +67,7 @@ bool LZCodec::inverse(SliceArray<byte>& input, SliceArray<byte>& output, int cou
6767template <>
6868const uint LZXCodec<false >::HASH_SEED = 0x1E35A7BD ;
6969template <>
70- const uint LZXCodec<false >::HASH_LOG = 15 ;
70+ const uint LZXCodec<false >::HASH_LOG = 16 ;
7171template <>
7272const uint LZXCodec<false >::HASH_RSHIFT = 64 - HASH_LOG;
7373template <>
@@ -391,24 +391,22 @@ bool LZXCodec<T>::forward(SliceArray<byte>& input, SliceArray<byte>& output, int
391391 anchor = srcIdx + bestLen;
392392 prefetchRead (&src[anchor + 64 ]);
393393 prefetchRead (&src[anchor + 128 ]);
394- srcIdx++;
395394
396395 while (srcIdx + 4 < anchor) {
397- const int32 h0 = hash (&src[srcIdx + 0 ]);
398- const int32 h1 = hash (&src[srcIdx + 1 ]);
399- const int32 h2 = hash (&src[srcIdx + 2 ]);
400- const int32 h3 = hash (&src[srcIdx + 3 ]);
401- _hashes[h0] = srcIdx + 0 ;
402- _hashes[h1] = srcIdx + 1 ;
403- _hashes[h2] = srcIdx + 2 ;
404- _hashes[h3] = srcIdx + 3 ;
405396 srcIdx += 4 ;
397+ const int32 h0 = hash (&src[srcIdx - 3 ]);
398+ const int32 h1 = hash (&src[srcIdx - 2 ]);
399+ const int32 h2 = hash (&src[srcIdx - 1 ]);
400+ const int32 h3 = hash (&src[srcIdx - 0 ]);
401+ _hashes[h0] = srcIdx - 3 ;
402+ _hashes[h1] = srcIdx - 2 ;
403+ _hashes[h2] = srcIdx - 1 ;
404+ _hashes[h3] = srcIdx - 0 ;
406405 }
407406
408- while (srcIdx < anchor) {
407+ while (++ srcIdx < anchor) {
409408 const int32 h = hash (&src[srcIdx]);
410409 _hashes[h] = srcIdx;
411- srcIdx++;
412410 }
413411 }
414412
0 commit comments