Skip to content

Commit bb76e37

Browse files
committed
Tweaks
1 parent 22e2404 commit bb76e37

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/transform/LZCodec.cpp

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,6 @@ bool LZXCodec<T>::forward(SliceArray<byte>& input, SliceArray<byte>& output, int
190190
if ((ref > minRef) && (memcmp(&src[srcIdx1], &src[ref], 4) == 0)) {
191191
// Check repd first
192192
bestLen = findMatch(src, srcIdx1, ref, min(srcEnd - srcIdx1, MAX_MATCH));
193-
194-
if (bestLen < minMatch) {
195-
ref = srcIdx1 - repd[1 - repIdx];
196-
197-
if ((ref > minRef) && (memcmp(&src[srcIdx1], &src[ref], 4) == 0)) {
198-
bestLen = findMatch(src, srcIdx1, ref, min(srcEnd - srcIdx1, MAX_MATCH));
199-
}
200-
}
201193
}
202194

203195
if (bestLen < minMatch) {
@@ -486,12 +478,12 @@ bool LZXCodec<T>::inverseV6(SliceArray<byte>& input, SliceArray<byte>& output, i
486478
// Read mLen remainder (if any) outside of token
487479
mLen = (mLen == 6) ? 6 + minMatch + readLength(src, mLenIdx) : mLen + minMatch;
488480
const int f2 = (token >> 4) & 1;
489-
const int f1 = ((token >> 4) | (token >> 3)) & 1;
481+
const int f1 = f2 | ((token >> 3) & 1); //faster with or
490482
dist = int(src[mIdx++]);
491-
dist = (dist << (8 * f1)) | (-f1 & int(src[mIdx]));
492-
mIdx += f1;
493483
dist = (dist << (8 * f2)) | (-f2 & int(src[mIdx]));
494484
mIdx += f2;
485+
dist = (dist << (8 * f1)) | (-f1 & int(src[mIdx]));
486+
mIdx += f1;
495487
}
496488

497489
prefetchRead(&src[mLenIdx]);

0 commit comments

Comments
 (0)