| 1 | /* LzFind.c -- Match finder for LZ algorithms |
| 2 | 2008-10-04 : Igor Pavlov : Public domain */ |
| 3 | |
| 4 | #include <string.h> |
| 5 | |
| 6 | #include "LzFind.h"cxx . . $ `<file>/compression/lzma/LzFind.h`/ |
| 7 | #include "LzHash.h"cxx . . $ `<file>/compression/lzma/LzHash.h`/ |
| 8 | |
| 9 | #define kEmptyHashValuecxx . . $ `compression/lzma/LzFind.c:9:9`! 0 |
| 10 | #define kMaxValForNormalizecxx . . $ `compression/lzma/LzFind.c:10:9`! ((UInt32)0xFFFFFFFF) |
| 11 | #define kNormalizeStepMincxx . . $ `compression/lzma/LzFind.c:11:9`! (1u << 10) /* it must be power of 2 */ /*MAB 1u */ |
| 12 | #define kNormalizeMaskcxx . . $ `compression/lzma/LzFind.c:12:9`! (~(kNormalizeStepMincxx . . $ `compression/lzma/LzFind.c:11:9`! - 1)) |
| 13 | #define kMaxHistorySizecxx . . $ `compression/lzma/LzFind.c:13:9`! ((UInt32)3 << 30) |
| 14 | |
| 15 | #define kStartMaxLencxx . . $ `compression/lzma/LzFind.c:15:9`! 3 |
| 16 | |
| 17 | static void LzInWindow_Freecxx . . $ LzInWindow_Free(e0c953fe8ccde46b).(CMatchFindercxx . . $ CMatchFinder# *p, ISzAlloccxx . . $ ISzAlloc# *alloc) |
| 18 | { |
| 19 | if (!p->directInputcxx . . $ _CMatchFinder#directInput.) |
| 20 | { |
| 21 | alloc->Freecxx . . $ ISzAlloc#Free.(alloc, p->bufferBasecxx . . $ _CMatchFinder#bufferBase.); |
| 22 | p->bufferBasecxx . . $ _CMatchFinder#bufferBase. = 0; |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | /* keepSizeBefore + keepSizeAfter + keepSizeReserv must be < 4G) */ |
| 27 | |
| 28 | static int LzInWindow_Createcxx . . $ LzInWindow_Create(77ad4bef576fe747).(CMatchFindercxx . . $ CMatchFinder# *p, UInt32cxx . . $ UInt32# keepSizeReserv, ISzAlloccxx . . $ ISzAlloc# *alloc) |
| 29 | { |
| 30 | UInt32cxx . . $ UInt32# blockSize = p->keepSizeBeforecxx . . $ _CMatchFinder#keepSizeBefore. + p->keepSizeAftercxx . . $ _CMatchFinder#keepSizeAfter. + keepSizeReserv; |
| 31 | if (p->directInputcxx . . $ _CMatchFinder#directInput.) |
| 32 | { |
| 33 | p->blockSizecxx . . $ _CMatchFinder#blockSize. = blockSize; |
| 34 | return 1; |
| 35 | } |
| 36 | if (p->bufferBasecxx . . $ _CMatchFinder#bufferBase. == 0 || p->blockSizecxx . . $ _CMatchFinder#blockSize. != blockSize) |
| 37 | { |
| 38 | LzInWindow_Freecxx . . $ LzInWindow_Free(e0c953fe8ccde46b).(p, alloc); |
| 39 | p->blockSizecxx . . $ _CMatchFinder#blockSize. = blockSize; |
| 40 | p->bufferBasecxx . . $ _CMatchFinder#bufferBase. = (Bytecxx . . $ Byte# *)alloc->Alloccxx . . $ ISzAlloc#Alloc.(alloc, (size_t)blockSize); |
| 41 | } |
| 42 | return (p->bufferBasecxx . . $ _CMatchFinder#bufferBase. != 0); |
| 43 | } |
| 44 | |
| 45 | Bytecxx . . $ Byte# *MatchFinder_GetPointerToCurrentPoscxx . . $ MatchFinder_GetPointerToCurrentPos(150d404b98f9b8cc).(CMatchFindercxx . . $ CMatchFinder# *p) { return p->buffercxx . . $ _CMatchFinder#buffer.; } |
| 46 | |
| 47 | /*MAB: static added, index replaced by idx to avoid shadowing a global variable */ |
| 48 | static |
| 49 | Bytecxx . . $ Byte# MatchFinder_GetIndexBytecxx . . $ MatchFinder_GetIndexByte(7dc769dc732ed9de).(CMatchFindercxx . . $ CMatchFinder# *p, Int32cxx . . $ Int32# idx) { return p->buffercxx . . $ _CMatchFinder#buffer.[idx]; } |
| 50 | |
| 51 | /*MAB: static added */ |
| 52 | static |
| 53 | UInt32cxx . . $ UInt32# MatchFinder_GetNumAvailableBytescxx . . $ MatchFinder_GetNumAvailableBytes(6b31cde66b0298ea).(CMatchFindercxx . . $ CMatchFinder# *p) { return p->streamPoscxx . . $ _CMatchFinder#streamPos. - p->poscxx . . $ _CMatchFinder#pos.; } |
| 54 | |
| 55 | void MatchFinder_ReduceOffsetscxx . . $ MatchFinder_ReduceOffsets(67dd09548828b5be).(CMatchFindercxx . . $ CMatchFinder# *p, UInt32cxx . . $ UInt32# subValue) |
| 56 | { |
| 57 | p->posLimitcxx . . $ _CMatchFinder#posLimit. -= subValue; |
| 58 | p->poscxx . . $ _CMatchFinder#pos. -= subValue; |
| 59 | p->streamPoscxx . . $ _CMatchFinder#streamPos. -= subValue; |
| 60 | } |
| 61 | |
| 62 | static void MatchFinder_ReadBlockcxx . . $ MatchFinder_ReadBlock(3e1b07d4842a3f23).(CMatchFindercxx . . $ CMatchFinder# *p) |
| 63 | { |
| 64 | if (p->streamEndWasReachedcxx . . $ _CMatchFinder#streamEndWasReached. || p->resultcxx . . $ _CMatchFinder#result. != SZ_OKcxx . . $ `compression/lzma/Types.h:13:9`!) |
| 65 | return; |
| 66 | for (;;) |
| 67 | { |
| 68 | Bytecxx . . $ Byte# *dest = p->buffercxx . . $ _CMatchFinder#buffer. + (p->streamPoscxx . . $ _CMatchFinder#streamPos. - p->poscxx . . $ _CMatchFinder#pos.); |
| 69 | size_t size = (size_t)(p->bufferBasecxx . . $ _CMatchFinder#bufferBase. + p->blockSizecxx . . $ _CMatchFinder#blockSize. - dest); |
| 70 | if (size == 0) |
| 71 | return; |
| 72 | p->resultcxx . . $ _CMatchFinder#result. = p->streamcxx . . $ _CMatchFinder#stream.->Readcxx . . $ ISeqInStream#Read.(p->streamcxx . . $ _CMatchFinder#stream., dest, &size); |
| 73 | if (p->resultcxx . . $ _CMatchFinder#result. != SZ_OKcxx . . $ `compression/lzma/Types.h:13:9`!) |
| 74 | return; |
| 75 | if (size == 0) |
| 76 | { |
| 77 | p->streamEndWasReachedcxx . . $ _CMatchFinder#streamEndWasReached. = 1; |
| 78 | return; |
| 79 | } |
| 80 | p->streamPoscxx . . $ _CMatchFinder#streamPos. += (UInt32cxx . . $ UInt32#)size; |
| 81 | if (p->streamPoscxx . . $ _CMatchFinder#streamPos. - p->poscxx . . $ _CMatchFinder#pos. > p->keepSizeAftercxx . . $ _CMatchFinder#keepSizeAfter.) |
| 82 | return; |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | void MatchFinder_MoveBlockcxx . . $ MatchFinder_MoveBlock(3e1b07d4842a3f23).(CMatchFindercxx . . $ CMatchFinder# *p) |
| 87 | { |
| 88 | memmovecxx . . $ memmove(cc817cb175f282d).(p->bufferBasecxx . . $ _CMatchFinder#bufferBase., |
| 89 | p->buffercxx . . $ _CMatchFinder#buffer. - p->keepSizeBeforecxx . . $ _CMatchFinder#keepSizeBefore., |
| 90 | (size_t)(p->streamPoscxx . . $ _CMatchFinder#streamPos. - p->poscxx . . $ _CMatchFinder#pos. + p->keepSizeBeforecxx . . $ _CMatchFinder#keepSizeBefore.)); |
| 91 | p->buffercxx . . $ _CMatchFinder#buffer. = p->bufferBasecxx . . $ _CMatchFinder#bufferBase. + p->keepSizeBeforecxx . . $ _CMatchFinder#keepSizeBefore.; |
| 92 | } |
| 93 | |
| 94 | int MatchFinder_NeedMovecxx . . $ MatchFinder_NeedMove(87dc8614b8a2e982).(CMatchFindercxx . . $ CMatchFinder# *p) |
| 95 | { |
| 96 | /* if (p->streamEndWasReached) return 0; */ |
| 97 | return ((size_t)(p->bufferBasecxx . . $ _CMatchFinder#bufferBase. + p->blockSizecxx . . $ _CMatchFinder#blockSize. - p->buffercxx . . $ _CMatchFinder#buffer.) <= p->keepSizeAftercxx . . $ _CMatchFinder#keepSizeAfter.); |
| 98 | } |
| 99 | |
| 100 | void MatchFinder_ReadIfRequiredcxx . . $ MatchFinder_ReadIfRequired(3e1b07d4842a3f23).(CMatchFindercxx . . $ CMatchFinder# *p) |
| 101 | { |
| 102 | if (p->streamEndWasReachedcxx . . $ _CMatchFinder#streamEndWasReached.) |
| 103 | return; |
| 104 | if (p->keepSizeAftercxx . . $ _CMatchFinder#keepSizeAfter. >= p->streamPoscxx . . $ _CMatchFinder#streamPos. - p->poscxx . . $ _CMatchFinder#pos.) |
| 105 | MatchFinder_ReadBlockcxx . . $ MatchFinder_ReadBlock(3e1b07d4842a3f23).(p); |
| 106 | } |
| 107 | |
| 108 | static void MatchFinder_CheckAndMoveAndReadcxx . . $ MatchFinder_CheckAndMoveAndRead(3e1b07d4842a3f23).(CMatchFindercxx . . $ CMatchFinder# *p) |
| 109 | { |
| 110 | if (MatchFinder_NeedMovecxx . . $ MatchFinder_NeedMove(87dc8614b8a2e982).(p)) |
| 111 | MatchFinder_MoveBlockcxx . . $ MatchFinder_MoveBlock(3e1b07d4842a3f23).(p); |
| 112 | MatchFinder_ReadBlockcxx . . $ MatchFinder_ReadBlock(3e1b07d4842a3f23).(p); |
| 113 | } |
| 114 | |
| 115 | static void MatchFinder_SetDefaultSettingscxx . . $ MatchFinder_SetDefaultSettings(3e1b07d4842a3f23).(CMatchFindercxx . . $ CMatchFinder# *p) |
| 116 | { |
| 117 | p->cutValuecxx . . $ _CMatchFinder#cutValue. = 32; |
| 118 | p->btModecxx . . $ _CMatchFinder#btMode. = 1; |
| 119 | p->numHashBytescxx . . $ _CMatchFinder#numHashBytes. = 4; |
| 120 | /* p->skipModeBits = 0; */ |
| 121 | p->directInputcxx . . $ _CMatchFinder#directInput. = 0; |
| 122 | p->bigHashcxx . . $ _CMatchFinder#bigHash. = 0; |
| 123 | } |
| 124 | |
| 125 | #define kCrcPolycxx . . $ `compression/lzma/LzFind.c:125:9`! 0xEDB88320 |
| 126 | |
| 127 | void MatchFinder_Constructcxx . . $ MatchFinder_Construct(3e1b07d4842a3f23).(CMatchFindercxx . . $ CMatchFinder# *p) |
| 128 | { |
| 129 | UInt32cxx . . $ UInt32# i; |
| 130 | p->bufferBasecxx . . $ _CMatchFinder#bufferBase. = 0; |
| 131 | p->directInputcxx . . $ _CMatchFinder#directInput. = 0; |
| 132 | p->hashcxx . . $ _CMatchFinder#hash. = 0; |
| 133 | MatchFinder_SetDefaultSettingscxx . . $ MatchFinder_SetDefaultSettings(3e1b07d4842a3f23).(p); |
| 134 | |
| 135 | for (i = 0; i < 256; i++) |
| 136 | { |
| 137 | UInt32cxx . . $ UInt32# r = i; |
| 138 | int j; |
| 139 | for (j = 0; j < 8; j++) |
| 140 | r = (r >> 1) ^ (kCrcPolycxx . . $ `compression/lzma/LzFind.c:125:9`! & ~((r & 1) - 1)); |
| 141 | p->crccxx . . $ _CMatchFinder#crc.[i] = r; |
| 142 | } |
| 143 | } |
| 144 | |
| 145 | static void MatchFinder_FreeThisClassMemorycxx . . $ MatchFinder_FreeThisClassMemory(e0c953fe8ccde46b).(CMatchFindercxx . . $ CMatchFinder# *p, ISzAlloccxx . . $ ISzAlloc# *alloc) |
| 146 | { |
| 147 | alloc->Freecxx . . $ ISzAlloc#Free.(alloc, p->hashcxx . . $ _CMatchFinder#hash.); |
| 148 | p->hashcxx . . $ _CMatchFinder#hash. = 0; |
| 149 | } |
| 150 | |
| 151 | void MatchFinder_Freecxx . . $ MatchFinder_Free(e0c953fe8ccde46b).(CMatchFindercxx . . $ CMatchFinder# *p, ISzAlloccxx . . $ ISzAlloc# *alloc) |
| 152 | { |
| 153 | MatchFinder_FreeThisClassMemorycxx . . $ MatchFinder_FreeThisClassMemory(e0c953fe8ccde46b).(p, alloc); |
| 154 | LzInWindow_Freecxx . . $ LzInWindow_Free(e0c953fe8ccde46b).(p, alloc); |
| 155 | } |
| 156 | |
| 157 | static CLzRefcxx . . $ CLzRef#* AllocRefscxx . . $ AllocRefs(e0545a900191ebcb).(UInt32cxx . . $ UInt32# num, ISzAlloccxx . . $ ISzAlloc# *alloc) |
| 158 | { |
| 159 | size_t sizeInBytes = (size_t)num * sizeof(CLzRefcxx . . $ CLzRef#); |
| 160 | if (sizeInBytes / sizeof(CLzRefcxx . . $ CLzRef#) != num) |
| 161 | return 0; |
| 162 | return (CLzRefcxx . . $ CLzRef# *)alloc->Alloccxx . . $ ISzAlloc#Alloc.(alloc, sizeInBytes); |
| 163 | } |
| 164 | |
| 165 | int MatchFinder_Createcxx . . $ MatchFinder_Create(64a49c537c4f0f0e).(CMatchFindercxx . . $ CMatchFinder# *p, UInt32cxx . . $ UInt32# historySize, |
| 166 | UInt32cxx . . $ UInt32# keepAddBufferBefore, UInt32cxx . . $ UInt32# matchMaxLen, UInt32cxx . . $ UInt32# keepAddBufferAfter, |
| 167 | ISzAlloccxx . . $ ISzAlloc# *alloc) |
| 168 | { |
| 169 | UInt32cxx . . $ UInt32# sizeReserv; |
| 170 | if (historySize > kMaxHistorySizecxx . . $ `compression/lzma/LzFind.c:13:9`!) |
| 171 | { |
| 172 | MatchFinder_Freecxx . . $ MatchFinder_Free(e0c953fe8ccde46b).(p, alloc); |
| 173 | return 0; |
| 174 | } |
| 175 | sizeReserv = historySize >> 1; |
| 176 | if (historySize > ((UInt32cxx . . $ UInt32#)2 << 30)) |
| 177 | sizeReserv = historySize >> 2; |
| 178 | sizeReserv += (keepAddBufferBefore + matchMaxLen + keepAddBufferAfter) / 2 + (1 << 19); |
| 179 | |
| 180 | p->keepSizeBeforecxx . . $ _CMatchFinder#keepSizeBefore. = historySize + keepAddBufferBefore + 1; |
| 181 | p->keepSizeAftercxx . . $ _CMatchFinder#keepSizeAfter. = matchMaxLen + keepAddBufferAfter; |
| 182 | /* we need one additional byte, since we use MoveBlock after pos++ and before dictionary using */ |
| 183 | if (LzInWindow_Createcxx . . $ LzInWindow_Create(77ad4bef576fe747).(p, sizeReserv, alloc)) |
| 184 | { |
| 185 | UInt32cxx . . $ UInt32# newCyclicBufferSize = (historySize /* >> p->skipModeBits */) + 1; |
| 186 | UInt32cxx . . $ UInt32# hs; |
| 187 | p->matchMaxLencxx . . $ _CMatchFinder#matchMaxLen. = matchMaxLen; |
| 188 | { |
| 189 | p->fixedHashSizecxx . . $ _CMatchFinder#fixedHashSize. = 0; |
| 190 | if (p->numHashBytescxx . . $ _CMatchFinder#numHashBytes. == 2) |
| 191 | hs = (1 << 16) - 1; |
| 192 | else |
| 193 | { |
| 194 | hs = historySize - 1; |
| 195 | hs |= (hs >> 1); |
| 196 | hs |= (hs >> 2); |
| 197 | hs |= (hs >> 4); |
| 198 | hs |= (hs >> 8); |
| 199 | hs >>= 1; |
| 200 | /* hs >>= p->skipModeBits; */ |
| 201 | hs |= 0xFFFF; /* don't change it! It's required for Deflate */ |
| 202 | if (hs > (1 << 24)) |
| 203 | { |
| 204 | if (p->numHashBytescxx . . $ _CMatchFinder#numHashBytes. == 3) |
| 205 | hs = (1 << 24) - 1; |
| 206 | else |
| 207 | hs >>= 1; |
| 208 | } |
| 209 | } |
| 210 | p->hashMaskcxx . . $ _CMatchFinder#hashMask. = hs; |
| 211 | hs++; |
| 212 | if (p->numHashBytescxx . . $ _CMatchFinder#numHashBytes. > 2) p->fixedHashSizecxx . . $ _CMatchFinder#fixedHashSize. += kHash2Sizecxx . . $ `compression/lzma/LzHash.h:7:9`!; |
| 213 | if (p->numHashBytescxx . . $ _CMatchFinder#numHashBytes. > 3) p->fixedHashSizecxx . . $ _CMatchFinder#fixedHashSize. += kHash3Sizecxx . . $ `compression/lzma/LzHash.h:8:9`!; |
| 214 | if (p->numHashBytescxx . . $ _CMatchFinder#numHashBytes. > 4) p->fixedHashSizecxx . . $ _CMatchFinder#fixedHashSize. += kHash4Sizecxx . . $ `compression/lzma/LzHash.h:9:9`!; |
| 215 | hs += p->fixedHashSizecxx . . $ _CMatchFinder#fixedHashSize.; |
| 216 | } |
| 217 | |
| 218 | { |
| 219 | UInt32cxx . . $ UInt32# prevSize = p->hashSizeSumcxx . . $ _CMatchFinder#hashSizeSum. + p->numSonscxx . . $ _CMatchFinder#numSons.; |
| 220 | UInt32cxx . . $ UInt32# newSize; |
| 221 | p->historySizecxx . . $ _CMatchFinder#historySize. = historySize; |
| 222 | p->hashSizeSumcxx . . $ _CMatchFinder#hashSizeSum. = hs; |
| 223 | p->cyclicBufferSizecxx . . $ _CMatchFinder#cyclicBufferSize. = newCyclicBufferSize; |
| 224 | p->numSonscxx . . $ _CMatchFinder#numSons. = (p->btModecxx . . $ _CMatchFinder#btMode. ? newCyclicBufferSize * 2 : newCyclicBufferSize); |
| 225 | newSize = p->hashSizeSumcxx . . $ _CMatchFinder#hashSizeSum. + p->numSonscxx . . $ _CMatchFinder#numSons.; |
| 226 | if (p->hashcxx . . $ _CMatchFinder#hash. != 0 && prevSize == newSize) |
| 227 | return 1; |
| 228 | MatchFinder_FreeThisClassMemorycxx . . $ MatchFinder_FreeThisClassMemory(e0c953fe8ccde46b).(p, alloc); |
| 229 | p->hashcxx . . $ _CMatchFinder#hash. = AllocRefscxx . . $ AllocRefs(e0545a900191ebcb).(newSize, alloc); |
| 230 | if (p->hashcxx . . $ _CMatchFinder#hash. != 0) |
| 231 | { |
| 232 | p->soncxx . . $ _CMatchFinder#son. = p->hashcxx . . $ _CMatchFinder#hash. + p->hashSizeSumcxx . . $ _CMatchFinder#hashSizeSum.; |
| 233 | return 1; |
| 234 | } |
| 235 | } |
| 236 | } |
| 237 | MatchFinder_Freecxx . . $ MatchFinder_Free(e0c953fe8ccde46b).(p, alloc); |
| 238 | return 0; |
| 239 | } |
| 240 | |
| 241 | static void MatchFinder_SetLimitscxx . . $ MatchFinder_SetLimits(3e1b07d4842a3f23).(CMatchFindercxx . . $ CMatchFinder# *p) |
| 242 | { |
| 243 | UInt32cxx . . $ UInt32# limit = kMaxValForNormalizecxx . . $ `compression/lzma/LzFind.c:10:9`! - p->poscxx . . $ _CMatchFinder#pos.; |
| 244 | UInt32cxx . . $ UInt32# limit2 = p->cyclicBufferSizecxx . . $ _CMatchFinder#cyclicBufferSize. - p->cyclicBufferPoscxx . . $ _CMatchFinder#cyclicBufferPos.; |
| 245 | if (limit2 < limit) |
| 246 | limit = limit2; |
| 247 | limit2 = p->streamPoscxx . . $ _CMatchFinder#streamPos. - p->poscxx . . $ _CMatchFinder#pos.; |
| 248 | if (limit2 <= p->keepSizeAftercxx . . $ _CMatchFinder#keepSizeAfter.) |
| 249 | { |
| 250 | if (limit2 > 0) |
| 251 | limit2 = 1; |
| 252 | } |
| 253 | else |
| 254 | limit2 -= p->keepSizeAftercxx . . $ _CMatchFinder#keepSizeAfter.; |
| 255 | if (limit2 < limit) |
| 256 | limit = limit2; |
| 257 | { |
| 258 | UInt32cxx . . $ UInt32# lenLimit = p->streamPoscxx . . $ _CMatchFinder#streamPos. - p->poscxx . . $ _CMatchFinder#pos.; |
| 259 | if (lenLimit > p->matchMaxLencxx . . $ _CMatchFinder#matchMaxLen.) |
| 260 | lenLimit = p->matchMaxLencxx . . $ _CMatchFinder#matchMaxLen.; |
| 261 | p->lenLimitcxx . . $ _CMatchFinder#lenLimit. = lenLimit; |
| 262 | } |
| 263 | p->posLimitcxx . . $ _CMatchFinder#posLimit. = p->poscxx . . $ _CMatchFinder#pos. + limit; |
| 264 | } |
| 265 | |
| 266 | void MatchFinder_Initcxx . . $ MatchFinder_Init(3e1b07d4842a3f23).(CMatchFindercxx . . $ CMatchFinder# *p) |
| 267 | { |
| 268 | UInt32cxx . . $ UInt32# i; |
| 269 | for (i = 0; i < p->hashSizeSumcxx . . $ _CMatchFinder#hashSizeSum.; i++) |
| 270 | p->hashcxx . . $ _CMatchFinder#hash.[i] = kEmptyHashValuecxx . . $ `compression/lzma/LzFind.c:9:9`!; |
| 271 | p->cyclicBufferPoscxx . . $ _CMatchFinder#cyclicBufferPos. = 0; |
| 272 | p->buffercxx . . $ _CMatchFinder#buffer. = p->bufferBasecxx . . $ _CMatchFinder#bufferBase.; |
| 273 | p->poscxx . . $ _CMatchFinder#pos. = p->streamPoscxx . . $ _CMatchFinder#streamPos. = p->cyclicBufferSizecxx . . $ _CMatchFinder#cyclicBufferSize.; |
| 274 | p->resultcxx . . $ _CMatchFinder#result. = SZ_OKcxx . . $ `compression/lzma/Types.h:13:9`!; |
| 275 | p->streamEndWasReachedcxx . . $ _CMatchFinder#streamEndWasReached. = 0; |
| 276 | MatchFinder_ReadBlockcxx . . $ MatchFinder_ReadBlock(3e1b07d4842a3f23).(p); |
| 277 | MatchFinder_SetLimitscxx . . $ MatchFinder_SetLimits(3e1b07d4842a3f23).(p); |
| 278 | } |
| 279 | |
| 280 | static UInt32cxx . . $ UInt32# MatchFinder_GetSubValuecxx . . $ MatchFinder_GetSubValue(6b31cde66b0298ea).(CMatchFindercxx . . $ CMatchFinder# *p) |
| 281 | { |
| 282 | return (p->poscxx . . $ _CMatchFinder#pos. - p->historySizecxx . . $ _CMatchFinder#historySize. - 1) & kNormalizeMaskcxx . . $ `compression/lzma/LzFind.c:12:9`!; |
| 283 | } |
| 284 | |
| 285 | void MatchFinder_Normalize3cxx . . $ MatchFinder_Normalize3(c10dd20a1588328c).(UInt32cxx . . $ UInt32# subValue, CLzRefcxx . . $ CLzRef# *items, UInt32cxx . . $ UInt32# numItems) |
| 286 | { |
| 287 | UInt32cxx . . $ UInt32# i; |
| 288 | for (i = 0; i < numItems; i++) |
| 289 | { |
| 290 | UInt32cxx . . $ UInt32# value = items[i]; |
| 291 | if (value <= subValue) |
| 292 | value = kEmptyHashValuecxx . . $ `compression/lzma/LzFind.c:9:9`!; |
| 293 | else |
| 294 | value -= subValue; |
| 295 | items[i] = value; |
| 296 | } |
| 297 | } |
| 298 | |
| 299 | static void MatchFinder_Normalizecxx . . $ MatchFinder_Normalize(3e1b07d4842a3f23).(CMatchFindercxx . . $ CMatchFinder# *p) |
| 300 | { |
| 301 | UInt32cxx . . $ UInt32# subValue = MatchFinder_GetSubValuecxx . . $ MatchFinder_GetSubValue(6b31cde66b0298ea).(p); |
| 302 | MatchFinder_Normalize3cxx . . $ MatchFinder_Normalize3(c10dd20a1588328c).(subValue, p->hashcxx . . $ _CMatchFinder#hash., p->hashSizeSumcxx . . $ _CMatchFinder#hashSizeSum. + p->numSonscxx . . $ _CMatchFinder#numSons.); |
| 303 | MatchFinder_ReduceOffsetscxx . . $ MatchFinder_ReduceOffsets(67dd09548828b5be).(p, subValue); |
| 304 | } |
| 305 | |
| 306 | static void MatchFinder_CheckLimitscxx . . $ MatchFinder_CheckLimits(3e1b07d4842a3f23).(CMatchFindercxx . . $ CMatchFinder# *p) |
| 307 | { |
| 308 | if (p->poscxx . . $ _CMatchFinder#pos. == kMaxValForNormalizecxx . . $ `compression/lzma/LzFind.c:10:9`!) |
| 309 | MatchFinder_Normalizecxx . . $ MatchFinder_Normalize(3e1b07d4842a3f23).(p); |
| 310 | |
| 311 | if (!p->streamEndWasReachedcxx . . $ _CMatchFinder#streamEndWasReached. && p->keepSizeAftercxx . . $ _CMatchFinder#keepSizeAfter. == p->streamPoscxx . . $ _CMatchFinder#streamPos. - p->poscxx . . $ _CMatchFinder#pos.) |
| 312 | MatchFinder_CheckAndMoveAndReadcxx . . $ MatchFinder_CheckAndMoveAndRead(3e1b07d4842a3f23).(p); |
| 313 | if (p->cyclicBufferPoscxx . . $ _CMatchFinder#cyclicBufferPos. == p->cyclicBufferSizecxx . . $ _CMatchFinder#cyclicBufferSize.) |
| 314 | p->cyclicBufferPoscxx . . $ _CMatchFinder#cyclicBufferPos. = 0; |
| 315 | MatchFinder_SetLimitscxx . . $ MatchFinder_SetLimits(3e1b07d4842a3f23).(p); |
| 316 | } |
| 317 | |
| 318 | static UInt32cxx . . $ UInt32# * Hc_GetMatchesSpeccxx . . $ Hc_GetMatchesSpec(9d97788ecf2d29c4).(UInt32cxx . . $ UInt32# lenLimit, UInt32cxx . . $ UInt32# curMatch, UInt32cxx . . $ UInt32# pos, const Bytecxx . . $ Byte# *cur, CLzRefcxx . . $ CLzRef# *son, |
| 319 | UInt32cxx . . $ UInt32# _cyclicBufferPos, UInt32cxx . . $ UInt32# _cyclicBufferSize, UInt32cxx . . $ UInt32# cutValue, |
| 320 | UInt32cxx . . $ UInt32# *distances, UInt32cxx . . $ UInt32# maxLen) |
| 321 | { |
| 322 | son[_cyclicBufferPos] = curMatch; |
| 323 | for (;;) |
| 324 | { |
| 325 | UInt32cxx . . $ UInt32# delta = pos - curMatch; |
| 326 | if (cutValue-- == 0 || delta >= _cyclicBufferSize) |
| 327 | return distances; |
| 328 | { |
| 329 | const Bytecxx . . $ Byte# *pb = cur - delta; |
| 330 | curMatch = son[_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)]; |
| 331 | if (pb[maxLen] == cur[maxLen] && *pb == *cur) |
| 332 | { |
| 333 | UInt32cxx . . $ UInt32# len = 0; |
| 334 | while (++len != lenLimit) |
| 335 | if (pb[len] != cur[len]) |
| 336 | break; |
| 337 | if (maxLen < len) |
| 338 | { |
| 339 | *distances++ = maxLen = len; |
| 340 | *distances++ = delta - 1; |
| 341 | if (len == lenLimit) |
| 342 | return distances; |
| 343 | } |
| 344 | } |
| 345 | } |
| 346 | } |
| 347 | } |
| 348 | |
| 349 | UInt32cxx . . $ UInt32# * GetMatchesSpec1cxx . . $ GetMatchesSpec1(9d97788ecf2d29c4).(UInt32cxx . . $ UInt32# lenLimit, UInt32cxx . . $ UInt32# curMatch, UInt32cxx . . $ UInt32# pos, const Bytecxx . . $ Byte# *cur, CLzRefcxx . . $ CLzRef# *son, |
| 350 | UInt32cxx . . $ UInt32# _cyclicBufferPos, UInt32cxx . . $ UInt32# _cyclicBufferSize, UInt32cxx . . $ UInt32# cutValue, |
| 351 | UInt32cxx . . $ UInt32# *distances, UInt32cxx . . $ UInt32# maxLen) |
| 352 | { |
| 353 | CLzRefcxx . . $ CLzRef# *ptr0 = son + (_cyclicBufferPos << 1) + 1; |
| 354 | CLzRefcxx . . $ CLzRef# *ptr1 = son + (_cyclicBufferPos << 1); |
| 355 | UInt32cxx . . $ UInt32# len0 = 0, len1 = 0; |
| 356 | for (;;) |
| 357 | { |
| 358 | UInt32cxx . . $ UInt32# delta = pos - curMatch; |
| 359 | if (cutValue-- == 0 || delta >= _cyclicBufferSize) |
| 360 | { |
| 361 | *ptr0 = *ptr1 = kEmptyHashValuecxx . . $ `compression/lzma/LzFind.c:9:9`!; |
| 362 | return distances; |
| 363 | } |
| 364 | { |
| 365 | CLzRefcxx . . $ CLzRef# *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1); |
| 366 | const Bytecxx . . $ Byte# *pb = cur - delta; |
| 367 | UInt32cxx . . $ UInt32# len = (len0 < len1 ? len0 : len1); |
| 368 | if (pb[len] == cur[len]) |
| 369 | { |
| 370 | if (++len != lenLimit && pb[len] == cur[len]) |
| 371 | while (++len != lenLimit) |
| 372 | if (pb[len] != cur[len]) |
| 373 | break; |
| 374 | if (maxLen < len) |
| 375 | { |
| 376 | *distances++ = maxLen = len; |
| 377 | *distances++ = delta - 1; |
| 378 | if (len == lenLimit) |
| 379 | { |
| 380 | *ptr1 = pair[0]; |
| 381 | *ptr0 = pair[1]; |
| 382 | return distances; |
| 383 | } |
| 384 | } |
| 385 | } |
| 386 | if (pb[len] < cur[len]) |
| 387 | { |
| 388 | *ptr1 = curMatch; |
| 389 | ptr1 = pair + 1; |
| 390 | curMatch = *ptr1; |
| 391 | len1 = len; |
| 392 | } |
| 393 | else |
| 394 | { |
| 395 | *ptr0 = curMatch; |
| 396 | ptr0 = pair; |
| 397 | curMatch = *ptr0; |
| 398 | len0 = len; |
| 399 | } |
| 400 | } |
| 401 | } |
| 402 | } |
| 403 | |
| 404 | static void SkipMatchesSpeccxx . . $ SkipMatchesSpec(426ae1c00c6f1341).(UInt32cxx . . $ UInt32# lenLimit, UInt32cxx . . $ UInt32# curMatch, UInt32cxx . . $ UInt32# pos, const Bytecxx . . $ Byte# *cur, CLzRefcxx . . $ CLzRef# *son, |
| 405 | UInt32cxx . . $ UInt32# _cyclicBufferPos, UInt32cxx . . $ UInt32# _cyclicBufferSize, UInt32cxx . . $ UInt32# cutValue) |
| 406 | { |
| 407 | CLzRefcxx . . $ CLzRef# *ptr0 = son + (_cyclicBufferPos << 1) + 1; |
| 408 | CLzRefcxx . . $ CLzRef# *ptr1 = son + (_cyclicBufferPos << 1); |
| 409 | UInt32cxx . . $ UInt32# len0 = 0, len1 = 0; |
| 410 | for (;;) |
| 411 | { |
| 412 | UInt32cxx . . $ UInt32# delta = pos - curMatch; |
| 413 | if (cutValue-- == 0 || delta >= _cyclicBufferSize) |
| 414 | { |
| 415 | *ptr0 = *ptr1 = kEmptyHashValuecxx . . $ `compression/lzma/LzFind.c:9:9`!; |
| 416 | return; |
| 417 | } |
| 418 | { |
| 419 | CLzRefcxx . . $ CLzRef# *pair = son + ((_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)) << 1); |
| 420 | const Bytecxx . . $ Byte# *pb = cur - delta; |
| 421 | UInt32cxx . . $ UInt32# len = (len0 < len1 ? len0 : len1); |
| 422 | if (pb[len] == cur[len]) |
| 423 | { |
| 424 | while (++len != lenLimit) |
| 425 | if (pb[len] != cur[len]) |
| 426 | break; |
| 427 | { |
| 428 | if (len == lenLimit) |
| 429 | { |
| 430 | *ptr1 = pair[0]; |
| 431 | *ptr0 = pair[1]; |
| 432 | return; |
| 433 | } |
| 434 | } |
| 435 | } |
| 436 | if (pb[len] < cur[len]) |
| 437 | { |
| 438 | *ptr1 = curMatch; |
| 439 | ptr1 = pair + 1; |
| 440 | curMatch = *ptr1; |
| 441 | len1 = len; |
| 442 | } |
| 443 | else |
| 444 | { |
| 445 | *ptr0 = curMatch; |
| 446 | ptr0 = pair; |
| 447 | curMatch = *ptr0; |
| 448 | len0 = len; |
| 449 | } |
| 450 | } |
| 451 | } |
| 452 | } |
| 453 | |
| 454 | #define MOVE_POScxx . . $ `compression/lzma/LzFind.c:454:9`! \ |
| 455 | ++p->cyclicBufferPos; \ |
| 456 | p->buffer++; \ |
| 457 | if (++p->pos == p->posLimit) MatchFinder_CheckLimits(p); |
| 458 | |
| 459 | #define MOVE_POS_RETcxx . . $ `compression/lzma/LzFind.c:459:9`! MOVE_POScxx . . $ `compression/lzma/LzFind.c:454:9`! return offset; |
| 460 | |
| 461 | static void MatchFinder_MovePoscxx . . $ MatchFinder_MovePos(3e1b07d4842a3f23).(CMatchFindercxx . . $ CMatchFinder# *p) { MOVE_POScxx . . $ `compression/lzma/LzFind.c:454:9`!; } |
| 462 | |
| 463 | #define GET_MATCHES_HEADER2cxx . . $ `compression/lzma/LzFind.c:463:9`!(minLen, ret_op) \ |
| 464 | UInt32 lenLimit; UInt32 hashValue; const Byte *cur; UInt32 curMatch; \ |
| 465 | lenLimit = p->lenLimit; { if (lenLimit < minLen) { MatchFinder_MovePos(p); ret_op; }} \ |
| 466 | cur = p->buffer; |
| 467 | |
| 468 | #define GET_MATCHES_HEADERcxx . . $ `compression/lzma/LzFind.c:468:9`!(minLen) GET_MATCHES_HEADER2cxx . . $ `compression/lzma/LzFind.c:463:9`!(minLen, return 0) |
| 469 | #define SKIP_HEADERcxx . . $ `compression/lzma/LzFind.c:469:9`!(minLen) GET_MATCHES_HEADER2cxx . . $ `compression/lzma/LzFind.c:463:9`!(minLen, continue) |
| 470 | |
| 471 | #define MF_PARAMScxx . . $ `compression/lzma/LzFind.c:471:9`!(p) p->pos, p->buffer, p->son, p->cyclicBufferPos, p->cyclicBufferSize, p->cutValue |
| 472 | |
| 473 | #define GET_MATCHES_FOOTERcxx . . $ `compression/lzma/LzFind.c:473:9`!(offset, maxLen) \ |
| 474 | offset = (UInt32)(GetMatchesSpec1(lenLimit, curMatch, MF_PARAMScxx . . $ `compression/lzma/LzFind.c:471:9`!(p), \ |
| 475 | distances + offset, maxLen) - distances); MOVE_POS_RETcxx . . $ `compression/lzma/LzFind.c:459:9`!; |
| 476 | |
| 477 | #define SKIP_FOOTERcxx . . $ `compression/lzma/LzFind.c:477:9`! \ |
| 478 | SkipMatchesSpec(lenLimit, curMatch, MF_PARAMScxx . . $ `compression/lzma/LzFind.c:471:9`!(p)); MOVE_POScxx . . $ `compression/lzma/LzFind.c:454:9`!; |
| 479 | |
| 480 | static UInt32cxx . . $ UInt32# Bt2_MatchFinder_GetMatchescxx . . $ Bt2_MatchFinder_GetMatches(243791520f511704).(CMatchFindercxx . . $ CMatchFinder# *p, UInt32cxx . . $ UInt32# *distances) |
| 481 | { |
| 482 | UInt32cxx . . $ UInt32# offset; |
| 483 | GET_MATCHES_HEADERcxx . . $ `compression/lzma/LzFind.c:468:9`!(2) |
| 484 | HASH2_CALCcxx . . $ `compression/lzma/LzHash.h:15:9`!; |
| 485 | curMatch = p->hashcxx . . $ _CMatchFinder#hash.[hashValue]; |
| 486 | p->hashcxx . . $ _CMatchFinder#hash.[hashValue] = p->poscxx . . $ _CMatchFinder#pos.; |
| 487 | offset = 0; |
| 488 | GET_MATCHES_FOOTERcxx . . $ `compression/lzma/LzFind.c:473:9`!(offset, 1) |
| 489 | } |
| 490 | |
| 491 | UInt32cxx . . $ UInt32# Bt3Zip_MatchFinder_GetMatchescxx . . $ Bt3Zip_MatchFinder_GetMatches(243791520f511704).(CMatchFindercxx . . $ CMatchFinder# *p, UInt32cxx . . $ UInt32# *distances) |
| 492 | { |
| 493 | UInt32cxx . . $ UInt32# offset; |
| 494 | GET_MATCHES_HEADERcxx . . $ `compression/lzma/LzFind.c:468:9`!(3) |
| 495 | HASH_ZIP_CALCcxx . . $ `compression/lzma/LzHash.h:37:9`!; |
| 496 | curMatch = p->hashcxx . . $ _CMatchFinder#hash.[hashValue]; |
| 497 | p->hashcxx . . $ _CMatchFinder#hash.[hashValue] = p->poscxx . . $ _CMatchFinder#pos.; |
| 498 | offset = 0; |
| 499 | GET_MATCHES_FOOTERcxx . . $ `compression/lzma/LzFind.c:473:9`!(offset, 2) |
| 500 | } |
| 501 | |
| 502 | static UInt32cxx . . $ UInt32# Bt3_MatchFinder_GetMatchescxx . . $ Bt3_MatchFinder_GetMatches(243791520f511704).(CMatchFindercxx . . $ CMatchFinder# *p, UInt32cxx . . $ UInt32# *distances) |
| 503 | { |
| 504 | UInt32cxx . . $ UInt32# hash2Value, delta2, maxLen, offset; |
| 505 | GET_MATCHES_HEADERcxx . . $ `compression/lzma/LzFind.c:468:9`!(3) |
| 506 | |
| 507 | HASH3_CALCcxx . . $ `compression/lzma/LzHash.h:17:9`!; |
| 508 | |
| 509 | delta2 = p->poscxx . . $ _CMatchFinder#pos. - p->hashcxx . . $ _CMatchFinder#hash.[hash2Value]; |
| 510 | curMatch = p->hashcxx . . $ _CMatchFinder#hash.[kFix3HashSizecxx . . $ `compression/lzma/LzHash.h:11:9`! + hashValue]; |
| 511 | |
| 512 | p->hashcxx . . $ _CMatchFinder#hash.[hash2Value] = |
| 513 | p->hashcxx . . $ _CMatchFinder#hash.[kFix3HashSizecxx . . $ `compression/lzma/LzHash.h:11:9`! + hashValue] = p->poscxx . . $ _CMatchFinder#pos.; |
| 514 | |
| 515 | |
| 516 | maxLen = 2; |
| 517 | offset = 0; |
| 518 | if (delta2 < p->cyclicBufferSizecxx . . $ _CMatchFinder#cyclicBufferSize. && *(cur - delta2) == *cur) |
| 519 | { |
| 520 | for (; maxLen != lenLimit; maxLen++) |
| 521 | if (cur[(ptrdiff_tcxx . . $ ptrdiff_t#)maxLen - (ptrdiff_tcxx . . $ ptrdiff_t#)delta2] != cur[maxLen]) /*MAB second casts (ptrdiff_t)*/ |
| 522 | break; |
| 523 | distances[0] = maxLen; |
| 524 | distances[1] = delta2 - 1; |
| 525 | offset = 2; |
| 526 | if (maxLen == lenLimit) |
| 527 | { |
| 528 | SkipMatchesSpeccxx . . $ SkipMatchesSpec(426ae1c00c6f1341).(lenLimit, curMatch, MF_PARAMScxx . . $ `compression/lzma/LzFind.c:471:9`!(p)); |
| 529 | MOVE_POS_RETcxx . . $ `compression/lzma/LzFind.c:459:9`!; |
| 530 | } |
| 531 | } |
| 532 | GET_MATCHES_FOOTERcxx . . $ `compression/lzma/LzFind.c:473:9`!(offset, maxLen) |
| 533 | } |
| 534 | |
| 535 | static UInt32cxx . . $ UInt32# Bt4_MatchFinder_GetMatchescxx . . $ Bt4_MatchFinder_GetMatches(243791520f511704).(CMatchFindercxx . . $ CMatchFinder# *p, UInt32cxx . . $ UInt32# *distances) |
| 536 | { |
| 537 | UInt32cxx . . $ UInt32# hash2Value, hash3Value, delta2, delta3, maxLen, offset; |
| 538 | GET_MATCHES_HEADERcxx . . $ `compression/lzma/LzFind.c:468:9`!(4) |
| 539 | |
| 540 | HASH4_CALCcxx . . $ `compression/lzma/LzHash.h:22:9`!; |
| 541 | |
| 542 | delta2 = p->poscxx . . $ _CMatchFinder#pos. - p->hashcxx . . $ _CMatchFinder#hash.[ hash2Value]; |
| 543 | delta3 = p->poscxx . . $ _CMatchFinder#pos. - p->hashcxx . . $ _CMatchFinder#hash.[kFix3HashSizecxx . . $ `compression/lzma/LzHash.h:11:9`! + hash3Value]; |
| 544 | curMatch = p->hashcxx . . $ _CMatchFinder#hash.[kFix4HashSizecxx . . $ `compression/lzma/LzHash.h:12:9`! + hashValue]; |
| 545 | |
| 546 | p->hashcxx . . $ _CMatchFinder#hash.[ hash2Value] = |
| 547 | p->hashcxx . . $ _CMatchFinder#hash.[kFix3HashSizecxx . . $ `compression/lzma/LzHash.h:11:9`! + hash3Value] = |
| 548 | p->hashcxx . . $ _CMatchFinder#hash.[kFix4HashSizecxx . . $ `compression/lzma/LzHash.h:12:9`! + hashValue] = p->poscxx . . $ _CMatchFinder#pos.; |
| 549 | |
| 550 | maxLen = 1; |
| 551 | offset = 0; |
| 552 | if (delta2 < p->cyclicBufferSizecxx . . $ _CMatchFinder#cyclicBufferSize. && *(cur - delta2) == *cur) |
| 553 | { |
| 554 | distances[0] = maxLen = 2; |
| 555 | distances[1] = delta2 - 1; |
| 556 | offset = 2; |
| 557 | } |
| 558 | if (delta2 != delta3 && delta3 < p->cyclicBufferSizecxx . . $ _CMatchFinder#cyclicBufferSize. && *(cur - delta3) == *cur) |
| 559 | { |
| 560 | maxLen = 3; |
| 561 | distances[offset + 1] = delta3 - 1; |
| 562 | offset += 2; |
| 563 | delta2 = delta3; |
| 564 | } |
| 565 | if (offset != 0) |
| 566 | { |
| 567 | for (; maxLen != lenLimit; maxLen++) |
| 568 | if (cur[(ptrdiff_tcxx . . $ ptrdiff_t#)maxLen - (ptrdiff_tcxx . . $ ptrdiff_t#)delta2] != cur[maxLen]) /*MAB casts second (ptrdiff_t)*/ |
| 569 | break; |
| 570 | distances[offset - 2] = maxLen; |
| 571 | if (maxLen == lenLimit) |
| 572 | { |
| 573 | SkipMatchesSpeccxx . . $ SkipMatchesSpec(426ae1c00c6f1341).(lenLimit, curMatch, MF_PARAMScxx . . $ `compression/lzma/LzFind.c:471:9`!(p)); |
| 574 | MOVE_POS_RETcxx . . $ `compression/lzma/LzFind.c:459:9`!; |
| 575 | } |
| 576 | } |
| 577 | if (maxLen < 3) |
| 578 | maxLen = 3; |
| 579 | GET_MATCHES_FOOTERcxx . . $ `compression/lzma/LzFind.c:473:9`!(offset, maxLen) |
| 580 | } |
| 581 | |
| 582 | static UInt32cxx . . $ UInt32# Hc4_MatchFinder_GetMatchescxx . . $ Hc4_MatchFinder_GetMatches(243791520f511704).(CMatchFindercxx . . $ CMatchFinder# *p, UInt32cxx . . $ UInt32# *distances) |
| 583 | { |
| 584 | UInt32cxx . . $ UInt32# hash2Value, hash3Value, delta2, delta3, maxLen, offset; |
| 585 | GET_MATCHES_HEADERcxx . . $ `compression/lzma/LzFind.c:468:9`!(4) |
| 586 | |
| 587 | HASH4_CALCcxx . . $ `compression/lzma/LzHash.h:22:9`!; |
| 588 | |
| 589 | delta2 = p->poscxx . . $ _CMatchFinder#pos. - p->hashcxx . . $ _CMatchFinder#hash.[ hash2Value]; |
| 590 | delta3 = p->poscxx . . $ _CMatchFinder#pos. - p->hashcxx . . $ _CMatchFinder#hash.[kFix3HashSizecxx . . $ `compression/lzma/LzHash.h:11:9`! + hash3Value]; |
| 591 | curMatch = p->hashcxx . . $ _CMatchFinder#hash.[kFix4HashSizecxx . . $ `compression/lzma/LzHash.h:12:9`! + hashValue]; |
| 592 | |
| 593 | p->hashcxx . . $ _CMatchFinder#hash.[ hash2Value] = |
| 594 | p->hashcxx . . $ _CMatchFinder#hash.[kFix3HashSizecxx . . $ `compression/lzma/LzHash.h:11:9`! + hash3Value] = |
| 595 | p->hashcxx . . $ _CMatchFinder#hash.[kFix4HashSizecxx . . $ `compression/lzma/LzHash.h:12:9`! + hashValue] = p->poscxx . . $ _CMatchFinder#pos.; |
| 596 | |
| 597 | maxLen = 1; |
| 598 | offset = 0; |
| 599 | if (delta2 < p->cyclicBufferSizecxx . . $ _CMatchFinder#cyclicBufferSize. && *(cur - delta2) == *cur) |
| 600 | { |
| 601 | distances[0] = maxLen = 2; |
| 602 | distances[1] = delta2 - 1; |
| 603 | offset = 2; |
| 604 | } |
| 605 | if (delta2 != delta3 && delta3 < p->cyclicBufferSizecxx . . $ _CMatchFinder#cyclicBufferSize. && *(cur - delta3) == *cur) |
| 606 | { |
| 607 | maxLen = 3; |
| 608 | distances[offset + 1] = delta3 - 1; |
| 609 | offset += 2; |
| 610 | delta2 = delta3; |
| 611 | } |
| 612 | if (offset != 0) |
| 613 | { |
| 614 | for (; maxLen != lenLimit; maxLen++) |
| 615 | if (cur[(ptrdiff_tcxx . . $ ptrdiff_t#)maxLen - (ptrdiff_tcxx . . $ ptrdiff_t#)delta2] != cur[maxLen]) /*MAB casts second (ptrdiff_t) */ |
| 616 | break; |
| 617 | |
| 618 | distances[offset - 2] = maxLen; |
| 619 | if (maxLen == lenLimit) |
| 620 | { |
| 621 | p->soncxx . . $ _CMatchFinder#son.[p->cyclicBufferPoscxx . . $ _CMatchFinder#cyclicBufferPos.] = curMatch; |
| 622 | MOVE_POS_RETcxx . . $ `compression/lzma/LzFind.c:459:9`!; |
| 623 | } |
| 624 | } |
| 625 | if (maxLen < 3) |
| 626 | maxLen = 3; |
| 627 | offset = (UInt32cxx . . $ UInt32#)(Hc_GetMatchesSpeccxx . . $ Hc_GetMatchesSpec(9d97788ecf2d29c4).(lenLimit, curMatch, MF_PARAMScxx . . $ `compression/lzma/LzFind.c:471:9`!(p), |
| 628 | distances + offset, maxLen) - (distances)); |
| 629 | MOVE_POS_RETcxx . . $ `compression/lzma/LzFind.c:459:9`! |
| 630 | } |
| 631 | |
| 632 | UInt32cxx . . $ UInt32# Hc3Zip_MatchFinder_GetMatchescxx . . $ Hc3Zip_MatchFinder_GetMatches(243791520f511704).(CMatchFindercxx . . $ CMatchFinder# *p, UInt32cxx . . $ UInt32# *distances) |
| 633 | { |
| 634 | UInt32cxx . . $ UInt32# offset; |
| 635 | GET_MATCHES_HEADERcxx . . $ `compression/lzma/LzFind.c:468:9`!(3) |
| 636 | HASH_ZIP_CALCcxx . . $ `compression/lzma/LzHash.h:37:9`!; |
| 637 | curMatch = p->hashcxx . . $ _CMatchFinder#hash.[hashValue]; |
| 638 | p->hashcxx . . $ _CMatchFinder#hash.[hashValue] = p->poscxx . . $ _CMatchFinder#pos.; |
| 639 | offset = (UInt32cxx . . $ UInt32#)(Hc_GetMatchesSpeccxx . . $ Hc_GetMatchesSpec(9d97788ecf2d29c4).(lenLimit, curMatch, MF_PARAMScxx . . $ `compression/lzma/LzFind.c:471:9`!(p), |
| 640 | distances, 2) - (distances)); |
| 641 | MOVE_POS_RETcxx . . $ `compression/lzma/LzFind.c:459:9`! |
| 642 | } |
| 643 | |
| 644 | static void Bt2_MatchFinder_Skipcxx . . $ Bt2_MatchFinder_Skip(67dd09548828b5be).(CMatchFindercxx . . $ CMatchFinder# *p, UInt32cxx . . $ UInt32# num) |
| 645 | { |
| 646 | do |
| 647 | { |
| 648 | SKIP_HEADERcxx . . $ `compression/lzma/LzFind.c:469:9`!(2) |
| 649 | HASH2_CALCcxx . . $ `compression/lzma/LzHash.h:15:9`!; |
| 650 | curMatch = p->hashcxx . . $ _CMatchFinder#hash.[hashValue]; |
| 651 | p->hashcxx . . $ _CMatchFinder#hash.[hashValue] = p->poscxx . . $ _CMatchFinder#pos.; |
| 652 | SKIP_FOOTERcxx . . $ `compression/lzma/LzFind.c:477:9`! |
| 653 | } |
| 654 | while (--num != 0); |
| 655 | } |
| 656 | |
| 657 | void Bt3Zip_MatchFinder_Skipcxx . . $ Bt3Zip_MatchFinder_Skip(67dd09548828b5be).(CMatchFindercxx . . $ CMatchFinder# *p, UInt32cxx . . $ UInt32# num) |
| 658 | { |
| 659 | do |
| 660 | { |
| 661 | SKIP_HEADERcxx . . $ `compression/lzma/LzFind.c:469:9`!(3) |
| 662 | HASH_ZIP_CALCcxx . . $ `compression/lzma/LzHash.h:37:9`!; |
| 663 | curMatch = p->hashcxx . . $ _CMatchFinder#hash.[hashValue]; |
| 664 | p->hashcxx . . $ _CMatchFinder#hash.[hashValue] = p->poscxx . . $ _CMatchFinder#pos.; |
| 665 | SKIP_FOOTERcxx . . $ `compression/lzma/LzFind.c:477:9`! |
| 666 | } |
| 667 | while (--num != 0); |
| 668 | } |
| 669 | |
| 670 | static void Bt3_MatchFinder_Skipcxx . . $ Bt3_MatchFinder_Skip(67dd09548828b5be).(CMatchFindercxx . . $ CMatchFinder# *p, UInt32cxx . . $ UInt32# num) |
| 671 | { |
| 672 | do |
| 673 | { |
| 674 | UInt32cxx . . $ UInt32# hash2Value; |
| 675 | SKIP_HEADERcxx . . $ `compression/lzma/LzFind.c:469:9`!(3) |
| 676 | HASH3_CALCcxx . . $ `compression/lzma/LzHash.h:17:9`!; |
| 677 | curMatch = p->hashcxx . . $ _CMatchFinder#hash.[kFix3HashSizecxx . . $ `compression/lzma/LzHash.h:11:9`! + hashValue]; |
| 678 | p->hashcxx . . $ _CMatchFinder#hash.[hash2Value] = |
| 679 | p->hashcxx . . $ _CMatchFinder#hash.[kFix3HashSizecxx . . $ `compression/lzma/LzHash.h:11:9`! + hashValue] = p->poscxx . . $ _CMatchFinder#pos.; |
| 680 | SKIP_FOOTERcxx . . $ `compression/lzma/LzFind.c:477:9`! |
| 681 | } |
| 682 | while (--num != 0); |
| 683 | } |
| 684 | |
| 685 | static void Bt4_MatchFinder_Skipcxx . . $ Bt4_MatchFinder_Skip(67dd09548828b5be).(CMatchFindercxx . . $ CMatchFinder# *p, UInt32cxx . . $ UInt32# num) |
| 686 | { |
| 687 | do |
| 688 | { |
| 689 | UInt32cxx . . $ UInt32# hash2Value, hash3Value; |
| 690 | SKIP_HEADERcxx . . $ `compression/lzma/LzFind.c:469:9`!(4) |
| 691 | HASH4_CALCcxx . . $ `compression/lzma/LzHash.h:22:9`!; |
| 692 | curMatch = p->hashcxx . . $ _CMatchFinder#hash.[kFix4HashSizecxx . . $ `compression/lzma/LzHash.h:12:9`! + hashValue]; |
| 693 | p->hashcxx . . $ _CMatchFinder#hash.[ hash2Value] = |
| 694 | p->hashcxx . . $ _CMatchFinder#hash.[kFix3HashSizecxx . . $ `compression/lzma/LzHash.h:11:9`! + hash3Value] = p->poscxx . . $ _CMatchFinder#pos.; |
| 695 | p->hashcxx . . $ _CMatchFinder#hash.[kFix4HashSizecxx . . $ `compression/lzma/LzHash.h:12:9`! + hashValue] = p->poscxx . . $ _CMatchFinder#pos.; |
| 696 | SKIP_FOOTERcxx . . $ `compression/lzma/LzFind.c:477:9`! |
| 697 | } |
| 698 | while (--num != 0); |
| 699 | } |
| 700 | |
| 701 | static void Hc4_MatchFinder_Skipcxx . . $ Hc4_MatchFinder_Skip(67dd09548828b5be).(CMatchFindercxx . . $ CMatchFinder# *p, UInt32cxx . . $ UInt32# num) |
| 702 | { |
| 703 | do |
| 704 | { |
| 705 | UInt32cxx . . $ UInt32# hash2Value, hash3Value; |
| 706 | SKIP_HEADERcxx . . $ `compression/lzma/LzFind.c:469:9`!(4) |
| 707 | HASH4_CALCcxx . . $ `compression/lzma/LzHash.h:22:9`!; |
| 708 | curMatch = p->hashcxx . . $ _CMatchFinder#hash.[kFix4HashSizecxx . . $ `compression/lzma/LzHash.h:12:9`! + hashValue]; |
| 709 | p->hashcxx . . $ _CMatchFinder#hash.[ hash2Value] = |
| 710 | p->hashcxx . . $ _CMatchFinder#hash.[kFix3HashSizecxx . . $ `compression/lzma/LzHash.h:11:9`! + hash3Value] = |
| 711 | p->hashcxx . . $ _CMatchFinder#hash.[kFix4HashSizecxx . . $ `compression/lzma/LzHash.h:12:9`! + hashValue] = p->poscxx . . $ _CMatchFinder#pos.; |
| 712 | p->soncxx . . $ _CMatchFinder#son.[p->cyclicBufferPoscxx . . $ _CMatchFinder#cyclicBufferPos.] = curMatch; |
| 713 | MOVE_POScxx . . $ `compression/lzma/LzFind.c:454:9`! |
| 714 | } |
| 715 | while (--num != 0); |
| 716 | } |
| 717 | |
| 718 | void Hc3Zip_MatchFinder_Skipcxx . . $ Hc3Zip_MatchFinder_Skip(67dd09548828b5be).(CMatchFindercxx . . $ CMatchFinder# *p, UInt32cxx . . $ UInt32# num) |
| 719 | { |
| 720 | do |
| 721 | { |
| 722 | SKIP_HEADERcxx . . $ `compression/lzma/LzFind.c:469:9`!(3) |
| 723 | HASH_ZIP_CALCcxx . . $ `compression/lzma/LzHash.h:37:9`!; |
| 724 | curMatch = p->hashcxx . . $ _CMatchFinder#hash.[hashValue]; |
| 725 | p->hashcxx . . $ _CMatchFinder#hash.[hashValue] = p->poscxx . . $ _CMatchFinder#pos.; |
| 726 | p->soncxx . . $ _CMatchFinder#son.[p->cyclicBufferPoscxx . . $ _CMatchFinder#cyclicBufferPos.] = curMatch; |
| 727 | MOVE_POScxx . . $ `compression/lzma/LzFind.c:454:9`! |
| 728 | } |
| 729 | while (--num != 0); |
| 730 | } |
| 731 | |
| 732 | void MatchFinder_CreateVTablecxx . . $ MatchFinder_CreateVTable(e9ccc59caa59e7a6).(CMatchFindercxx . . $ CMatchFinder# *p, IMatchFindercxx . . $ IMatchFinder# *vTable) |
| 733 | { |
| 734 | vTable->Initcxx . . $ _IMatchFinder#Init. = (Mf_Init_Funccxx . . $ Mf_Init_Func#)MatchFinder_Initcxx . . $ MatchFinder_Init(3e1b07d4842a3f23).; |
| 735 | vTable->GetIndexBytecxx . . $ _IMatchFinder#GetIndexByte. = (Mf_GetIndexByte_Funccxx . . $ Mf_GetIndexByte_Func#)MatchFinder_GetIndexBytecxx . . $ MatchFinder_GetIndexByte(7dc769dc732ed9de).; |
| 736 | vTable->GetNumAvailableBytescxx . . $ _IMatchFinder#GetNumAvailableBytes. = (Mf_GetNumAvailableBytes_Funccxx . . $ Mf_GetNumAvailableBytes_Func#)MatchFinder_GetNumAvailableBytescxx . . $ MatchFinder_GetNumAvailableBytes(6b31cde66b0298ea).; |
| 737 | vTable->GetPointerToCurrentPoscxx . . $ _IMatchFinder#GetPointerToCurrentPos. = (Mf_GetPointerToCurrentPos_Funccxx . . $ Mf_GetPointerToCurrentPos_Func#)MatchFinder_GetPointerToCurrentPoscxx . . $ MatchFinder_GetPointerToCurrentPos(150d404b98f9b8cc).; |
| 738 | if (!p->btModecxx . . $ _CMatchFinder#btMode.) |
| 739 | { |
| 740 | vTable->GetMatchescxx . . $ _IMatchFinder#GetMatches. = (Mf_GetMatches_Funccxx . . $ Mf_GetMatches_Func#)Hc4_MatchFinder_GetMatchescxx . . $ Hc4_MatchFinder_GetMatches(243791520f511704).; |
| 741 | vTable->Skipcxx . . $ _IMatchFinder#Skip. = (Mf_Skip_Funccxx . . $ Mf_Skip_Func#)Hc4_MatchFinder_Skipcxx . . $ Hc4_MatchFinder_Skip(67dd09548828b5be).; |
| 742 | } |
| 743 | else if (p->numHashBytescxx . . $ _CMatchFinder#numHashBytes. == 2) |
| 744 | { |
| 745 | vTable->GetMatchescxx . . $ _IMatchFinder#GetMatches. = (Mf_GetMatches_Funccxx . . $ Mf_GetMatches_Func#)Bt2_MatchFinder_GetMatchescxx . . $ Bt2_MatchFinder_GetMatches(243791520f511704).; |
| 746 | vTable->Skipcxx . . $ _IMatchFinder#Skip. = (Mf_Skip_Funccxx . . $ Mf_Skip_Func#)Bt2_MatchFinder_Skipcxx . . $ Bt2_MatchFinder_Skip(67dd09548828b5be).; |
| 747 | } |
| 748 | else if (p->numHashBytescxx . . $ _CMatchFinder#numHashBytes. == 3) |
| 749 | { |
| 750 | vTable->GetMatchescxx . . $ _IMatchFinder#GetMatches. = (Mf_GetMatches_Funccxx . . $ Mf_GetMatches_Func#)Bt3_MatchFinder_GetMatchescxx . . $ Bt3_MatchFinder_GetMatches(243791520f511704).; |
| 751 | vTable->Skipcxx . . $ _IMatchFinder#Skip. = (Mf_Skip_Funccxx . . $ Mf_Skip_Func#)Bt3_MatchFinder_Skipcxx . . $ Bt3_MatchFinder_Skip(67dd09548828b5be).; |
| 752 | } |
| 753 | else |
| 754 | { |
| 755 | vTable->GetMatchescxx . . $ _IMatchFinder#GetMatches. = (Mf_GetMatches_Funccxx . . $ Mf_GetMatches_Func#)Bt4_MatchFinder_GetMatchescxx . . $ Bt4_MatchFinder_GetMatches(243791520f511704).; |
| 756 | vTable->Skipcxx . . $ _IMatchFinder#Skip. = (Mf_Skip_Funccxx . . $ Mf_Skip_Func#)Bt4_MatchFinder_Skipcxx . . $ Bt4_MatchFinder_Skip(67dd09548828b5be).; |
| 757 | } |
| 758 | } |