コード例 #1
0
ファイル: LzFindMt.cs プロジェクト: Nuclearistt/TEKLauncher
            private static void MatchFinderMt3_Skip(CMatchFinderMt p, uint num)
            {
                do
                {
                    if (p.mBtBufPos == p.mBtBufPosLimit)
                    {
                        p.MatchFinderMt_GetNextBlock_Bt();
                    }

                    if (p.mBtNumAvailBytes-- >= 3)
                    {
                        P <byte> cur        = p.mPointerToCurPos;
                        uint[]   hash       = p.mLocalHash;
                        uint     temp       = cur[0].CRC() ^ cur[1];
                        uint     hash2Value = temp & (kHash2Size - 1);
                        uint     hash3Value = (temp ^ ((uint)cur[2] << 8)) & (kHash3Size - 1);
                        hash[kFix3HashSize + hash3Value] = p.mLzPos;
                        hash[hash2Value] = p.mLzPos;
                    }

                    p.mLzPos++;
                    p.mPointerToCurPos++;
                    p.mBtBufPos += p.mBtBuf[p.mBtBufPos] + 1;
                }while (--num != 0);
            }
コード例 #2
0
ファイル: LzFindMt.cs プロジェクト: Nuclearistt/TEKLauncher
            private static P <uint> MixMatches4(CMatchFinderMt p, uint matchMinPos, P <uint> distances)
            {
                uint[]   hash  = p.mHash;
                P <byte> cur   = p.mPointerToCurPos;
                uint     lzPos = p.mLzPos;

                uint temp       = cur[0].CRC() ^ cur[1];
                uint hash2Value = temp & (kHash2Size - 1);
                uint hash3Value = (temp ^ ((uint)cur[2] << 8)) & (kHash3Size - 1);
                uint hash4Value = (temp ^ ((uint)cur[2] << 8) ^ (cur[3].CRC() << 5)) & (kHash4Size - 1);

                uint curMatch2 = hash[hash2Value];
                uint curMatch3 = hash[kFix3HashSize + hash3Value];
                uint curMatch4 = hash[kFix4HashSize + hash4Value];

                hash[hash2Value] = lzPos;
                hash[kFix3HashSize + hash3Value] = lzPos;
                hash[kFix4HashSize + hash4Value] = lzPos;

                if (curMatch2 >= matchMinPos && cur[(long)curMatch2 - lzPos] == cur[0])
                {
                    distances[1] = lzPos - curMatch2 - 1;
                    if (cur[(long)curMatch2 - lzPos + 2] == cur[2])
                    {
                        distances[0] = (cur[(long)curMatch2 - lzPos + 3] == cur[3]) ? 4u : 3u;
                        return(distances + 2);
                    }

                    distances[0] = 2;
                    distances   += 2;
                }

                if (curMatch3 >= matchMinPos && cur[(long)curMatch3 - lzPos] == cur[0])
                {
                    distances[1] = lzPos - curMatch3 - 1;
                    if (cur[(long)curMatch3 - lzPos + 3] == cur[3])
                    {
                        distances[0] = 4;
                        return(distances + 2);
                    }

                    distances[0] = 3;
                    distances   += 2;
                }

                if (curMatch4 >= matchMinPos &&
                    cur[(long)curMatch4 - lzPos] == cur[0] &&
                    cur[(long)curMatch4 - lzPos + 3] == cur[3])
                {
                    distances[0] = 4;
                    distances++;

                    distances[0] = lzPos - curMatch4 - 1;
                    distances++;
                }

                return(distances);
            }
コード例 #3
0
ファイル: LzFindMt.cs プロジェクト: Nuclearistt/TEKLauncher
            private static void MatchFinderMt0_Skip(CMatchFinderMt p, uint num)
            {
                do
                {
                    if (p.mBtBufPos == p.mBtBufPosLimit)
                    {
                        p.MatchFinderMt_GetNextBlock_Bt();
                    }

                    p.mBtNumAvailBytes--;
                    p.mLzPos++;
                    p.mPointerToCurPos++;
                    p.mBtBufPos += p.mBtBuf[p.mBtBufPos] + 1;
                }while (--num != 0);
            }
コード例 #4
0
ファイル: LzFindMt.cs プロジェクト: Nuclearistt/TEKLauncher
            private static uint MatchFinderMt_GetMatches(CMatchFinderMt p, P <uint> distances)
            {
                TR("MatchFinderMt_GetMatches", p.mBtBufPos);
                P <uint> btBuf = p.mBtBuf + p.mBtBufPos;
                uint     len   = btBuf[0];

                btBuf++;
                p.mBtBufPos += 1 + len;

                if (len == 0)
                {
                    if (p.mBtNumAvailBytes-- >= 4)
                    {
                        len = (uint)(p.mInterface.MixMatchesFunc(p, p.mLzPos - p.mLocalHistorySize, distances) - distances);
                    }
                }
                else
                {
                    // Condition: there are matches in btBuf with length < p.numHashBytes
                    p.mBtNumAvailBytes--;
                    P <uint> distances2 = p.mInterface.MixMatchesFunc(p, p.mLzPos - btBuf[1], distances);

                    do
                    {
                        distances2[0] = btBuf[0];
                        distances2++;
                        btBuf++;

                        distances2[0] = btBuf[0];
                        distances2++;
                        btBuf++;

                        len -= 2;
                    }while (len != 0);

                    len = (uint)(distances2 - distances);
                }

                p.mLzPos++;
                p.mPointerToCurPos++;
                return(len);
            }
コード例 #5
0
ファイル: LzFindMt.cs プロジェクト: Nuclearistt/TEKLauncher
            private static P <uint> MixMatches2(CMatchFinderMt p, uint matchMinPos, P <uint> distances)
            {
                uint[]   hash       = p.mLocalHash;
                P <byte> cur        = p.mPointerToCurPos;
                uint     lzPos      = p.mLzPos;
                uint     hash2Value = (cur[0].CRC() ^ cur[1]) & (kHash2Size - 1);

                uint curMatch2 = hash[hash2Value];

                hash[hash2Value] = lzPos;

                if (curMatch2 >= matchMinPos && cur[(long)curMatch2 - lzPos] == cur[0])
                {
                    distances[0] = 2;
                    distances++;
                    distances[0] = lzPos - curMatch2 - 1;
                    distances++;
                }

                return(distances);
            }
コード例 #6
0
ファイル: LzFindMt.cs プロジェクト: Nuclearistt/TEKLauncher
            private static void MatchFinderMt2_Skip(CMatchFinderMt p, uint num)
            {
                do
                {
                    if (p.mBtBufPos == p.mBtBufPosLimit)
                    {
                        p.MatchFinderMt_GetNextBlock_Bt();
                    }

                    if (p.mBtNumAvailBytes-- >= 2)
                    {
                        P <byte> cur        = p.mPointerToCurPos;
                        uint[]   hash       = p.mLocalHash;
                        uint     hash2Value = (cur[0].CRC() ^ cur[1]) & (kHash2Size - 1);
                        hash[hash2Value] = p.mLzPos;
                    }

                    p.mLzPos++;
                    p.mPointerToCurPos++;
                    p.mBtBufPos += p.mBtBuf[p.mBtBufPos] + 1;
                }while (--num != 0);
            }
コード例 #7
0
ファイル: LzFindMt.cs プロジェクト: Nuclearistt/TEKLauncher
            /* Call it after ReleaseStream / SetStream */
            private static void MatchFinderMt_Init(CMatchFinderMt p)
            {
                CMatchFinder mf = p;

                p.mBtBufPos   = p.mBtBufPosLimit = 0;
                p.mHashBufPos = p.mHashBufPosLimit = 0;
                mf.MatchFinder_Init();
                p.mPointerToCurPos = mf.MatchFinder_GetPointerToCurrentPos();
                p.mBtNumAvailBytes = 0;
                p.mLzPos           = p.mLocalHistorySize + 1;

                p.mLocalHash          = mf.mHash;
                p.mLocalFixedHashSize = mf.mFixedHashSize;

                p.mLocalSon              = mf.mSon;
                p.mLocalMatchMaxLen      = mf.mMatchMaxLen;
                p.mLocalNumHashBytes     = mf.mNumHashBytes;
                p.mLocalPos              = mf.mPos;
                p.mLocalBuffer           = mf.mBuffer;
                p.mLocalCyclicBufferPos  = mf.mCyclicBufferPos;
                p.mLocalCyclicBufferSize = mf.mCyclicBufferSize;
                p.mLocalCutValue         = mf.mCutValue;
            }
コード例 #8
0
ファイル: LzFindMt.cs プロジェクト: Nuclearistt/TEKLauncher
            private static uint MatchFinderMt2_GetMatches(CMatchFinderMt p, P <uint> distances)
            {
                P <uint> btBuf = p.mBtBuf + p.mBtBufPos;
                uint     len   = btBuf[0];

                btBuf++;
                p.mBtBufPos += 1 + len;
                p.mBtNumAvailBytes--;

                for (uint i = 0; i < len; i += 2)
                {
                    distances[0] = btBuf[0];
                    distances++;
                    btBuf++;

                    distances[0] = btBuf[0];
                    distances++;
                    btBuf++;
                }

                p.mLzPos++;
                p.mPointerToCurPos++;
                return(len);
            }
コード例 #9
0
ファイル: LzFindMt.cs プロジェクト: jolhe006/managed-lzma
            /* Call it after ReleaseStream / SetStream */
            private static void MatchFinderMt_Init(CMatchFinderMt p)
            {
                CMatchFinder mf = p;

                p.mBtBufPos = p.mBtBufPosLimit = 0;
                p.mHashBufPos = p.mHashBufPosLimit = 0;
                mf.MatchFinder_Init();
                p.mPointerToCurPos = mf.MatchFinder_GetPointerToCurrentPos();
                p.mBtNumAvailBytes = 0;
                p.mLzPos = p.mLocalHistorySize + 1;

                p.mLocalHash = mf.mHash;
                p.mLocalFixedHashSize = mf.mFixedHashSize;

                p.mLocalSon = mf.mSon;
                p.mLocalMatchMaxLen = mf.mMatchMaxLen;
                p.mLocalNumHashBytes = mf.mNumHashBytes;
                p.mLocalPos = mf.mPos;
                p.mLocalBuffer = mf.mBuffer;
                p.mLocalCyclicBufferPos = mf.mCyclicBufferPos;
                p.mLocalCyclicBufferSize = mf.mCyclicBufferSize;
                p.mLocalCutValue = mf.mCutValue;
            }
コード例 #10
0
ファイル: LzFindMt.cs プロジェクト: jolhe006/managed-lzma
            private static uint MatchFinderMt_GetMatches(CMatchFinderMt p, P<uint> distances)
            {
                TR("MatchFinderMt_GetMatches", p.mBtBufPos);
                P<uint> btBuf = p.mBtBuf + p.mBtBufPos;
                uint len = btBuf[0];
                btBuf++;
                p.mBtBufPos += 1 + len;

                if(len == 0)
                {
                    if(p.mBtNumAvailBytes-- >= 4)
                        len = (uint)(p.mInterface.MixMatchesFunc(p, p.mLzPos - p.mLocalHistorySize, distances) - distances);
                }
                else
                {
                    // Condition: there are matches in btBuf with length < p.numHashBytes
                    p.mBtNumAvailBytes--;
                    P<uint> distances2 = p.mInterface.MixMatchesFunc(p, p.mLzPos - btBuf[1], distances);

                    do
                    {
                        distances2[0] = btBuf[0];
                        distances2++;
                        btBuf++;

                        distances2[0] = btBuf[0];
                        distances2++;
                        btBuf++;

                        len -= 2;
                    }
                    while(len != 0);

                    len = (uint)(distances2 - distances);
                }

                p.mLzPos++;
                p.mPointerToCurPos++;
                return len;
            }
コード例 #11
0
ファイル: LzFindMt.cs プロジェクト: jolhe006/managed-lzma
            private static P<uint> MixMatches3(CMatchFinderMt p, uint matchMinPos, P<uint> distances)
            {
                uint[] hash = p.mLocalHash;
                P<byte> cur = p.mPointerToCurPos;
                uint lzPos = p.mLzPos;
                uint temp = cur[0].CRC() ^ cur[1];
                uint hash2Value = temp & (kHash2Size - 1);
                uint hash3Value = (temp ^ ((uint)cur[2] << 8)) & (kHash3Size - 1);

                uint curMatch2 = hash[hash2Value];
                uint curMatch3 = hash[kFix3HashSize + hash3Value];

                hash[hash2Value] = lzPos;
                hash[kFix3HashSize + hash3Value] = lzPos;

                if(curMatch2 >= matchMinPos && cur[curMatch2 - lzPos] == cur[0])
                {
                    distances[1] = lzPos - curMatch2 - 1;

                    if(cur[curMatch2 - lzPos + 2] == cur[2])
                    {
                        distances[0] = 3;
                        return distances + 2;
                    }

                    distances[0] = 2;
                    distances += 2;
                }

                if(curMatch3 >= matchMinPos && cur[curMatch3 - lzPos] == cur[0])
                {
                    distances[0] = 3;
                    distances++;

                    distances[0] = lzPos - curMatch3 - 1;
                    distances++;
                }

                return distances;
            }
コード例 #12
0
ファイル: LzFindMt.cs プロジェクト: jolhe006/managed-lzma
            private static P<uint> MixMatches2(CMatchFinderMt p, uint matchMinPos, P<uint> distances)
            {
                uint[] hash = p.mLocalHash;
                P<byte> cur = p.mPointerToCurPos;
                uint lzPos = p.mLzPos;
                uint hash2Value = (cur[0].CRC() ^ cur[1]) & (kHash2Size - 1);

                uint curMatch2 = hash[hash2Value];
                hash[hash2Value] = lzPos;

                if(curMatch2 >= matchMinPos && cur[(long)curMatch2 - lzPos] == cur[0])
                {
                    distances[0] = 2;
                    distances++;
                    distances[0] = lzPos - curMatch2 - 1;
                    distances++;
                }

                return distances;
            }
コード例 #13
0
ファイル: LzFindMt.cs プロジェクト: jolhe006/managed-lzma
            private static void MatchFinderMt2_Skip(CMatchFinderMt p, uint num)
            {
                do
                {
                    if(p.mBtBufPos == p.mBtBufPosLimit)
                        p.MatchFinderMt_GetNextBlock_Bt();

                    if(p.mBtNumAvailBytes-- >= 2)
                    {
                        P<byte> cur = p.mPointerToCurPos;
                        uint[] hash = p.mLocalHash;
                        uint hash2Value = (cur[0].CRC() ^ cur[1]) & (kHash2Size - 1);
                        hash[hash2Value] = p.mLzPos;
                    }

                    p.mLzPos++;
                    p.mPointerToCurPos++;
                    p.mBtBufPos += p.mBtBuf[p.mBtBufPos] + 1;
                }
                while(--num != 0);
            }
コード例 #14
0
ファイル: LzFindMt.cs プロジェクト: jolhe006/managed-lzma
            private static uint MatchFinderMt2_GetMatches(CMatchFinderMt p, P<uint> distances)
            {
                P<uint> btBuf = p.mBtBuf + p.mBtBufPos;
                uint len = btBuf[0];
                btBuf++;
                p.mBtBufPos += 1 + len;
                p.mBtNumAvailBytes--;

                for(uint i = 0; i < len; i += 2)
                {
                    distances[0] = btBuf[0];
                    distances++;
                    btBuf++;

                    distances[0] = btBuf[0];
                    distances++;
                    btBuf++;
                }

                p.mLzPos++;
                p.mPointerToCurPos++;
                return len;
            }
コード例 #15
0
ファイル: LzFindMt.cs プロジェクト: jolhe006/managed-lzma
            private static void MatchFinderMt4_Skip(CMatchFinderMt p, uint count)
            {
                do
                {
                    if(p.mBtBufPos == p.mBtBufPosLimit)
                        p.MatchFinderMt_GetNextBlock_Bt();

                    if(p.mBtNumAvailBytes-- >= 4)
                    {
                        P<byte> cur = p.mPointerToCurPos;
                        uint[] hash = p.mHash;
                        uint temp = cur[0].CRC() ^ cur[1];
                        uint hash2Value = temp & (kHash2Size - 1);
                        uint hash3Value = (temp ^ ((uint)cur[2] << 8)) & (kHash3Size - 1);
                        uint hash4Value = (temp ^ ((uint)cur[2] << 8) ^ (cur[3].CRC() << 5)) & (kHash4Size - 1);
                        hash[kFix4HashSize + hash4Value] = p.mLzPos;
                        hash[kFix3HashSize + hash3Value] = p.mLzPos;
                        hash[hash2Value] = p.mLzPos;
                    }

                    p.mLzPos++;
                    p.mPointerToCurPos++;
                    p.mBtBufPos += p.mBtBuf[p.mBtBufPos] + 1;
                }
                while(--count != 0);
            }
コード例 #16
0
ファイル: LzmaEnc.cs プロジェクト: modulexcite/managed-lzma
            internal CLzmaEnc() // LzmaEnc_Construct
            {
                mRC.RangeEnc_Construct();
#if !_7ZIP_ST
                mMatchFinderMt = new CMatchFinderMt();
                mMatchFinderBase = mMatchFinderMt;
#else
                mMatchFinderBase = new CMatchFinder();
#endif
                LzmaEnc_SetProps(CLzmaEncProps.LzmaEncProps_Init());
                LzmaEnc_FastPosInit();
                LzmaEnc_InitPriceTables(mProbPrices);
                mLitProbs = null;
                mSaveState.mLitProbs = null;
            }
コード例 #17
0
ファイル: LzFindMt.cs プロジェクト: jolhe006/managed-lzma
            private static void MatchFinderMt0_Skip(CMatchFinderMt p, uint num)
            {
                do
                {
                    if(p.mBtBufPos == p.mBtBufPosLimit)
                        p.MatchFinderMt_GetNextBlock_Bt();

                    p.mBtNumAvailBytes--;
                    p.mLzPos++;
                    p.mPointerToCurPos++;
                    p.mBtBufPos += p.mBtBuf[p.mBtBufPos] + 1;
                }
                while(--num != 0);
            }