コード例 #1
0
ファイル: LzFind.cs プロジェクト: 0-v-0/tiny7z
            private static uint[] AllocRefs(uint num, ISzAlloc alloc)
            {
                long sizeInBytes = (long)num * sizeof(uint);

                if (sizeInBytes / sizeof(uint) != num)
                {
                    return(null);
                }

                return(alloc.AllocUInt32(alloc, num));
            }
コード例 #2
0
ファイル: LzFindMt.cs プロジェクト: Nuclearistt/TEKLauncher
            internal SRes MatchFinderMt_Create(uint historySize, uint keepAddBufferBefore, uint matchMaxLen, uint keepAddBufferAfter, ISzAlloc alloc)
            {
                mLocalHistorySize = historySize;

                if (kMtBtBlockSize <= matchMaxLen * 4)
                {
                    return(SZ_ERROR_PARAM);
                }

                if (mHashBuf == null)
                {
                    mHashBuf = alloc.AllocUInt32(alloc, kHashBufferSize + kBtBufferSize);
                    if (mHashBuf == null)
                    {
                        return(SZ_ERROR_MEM);
                    }

                    mBtBuf = P.From(mHashBuf, kHashBufferSize);
                }

                keepAddBufferBefore += (kHashBufferSize + kBtBufferSize);
                keepAddBufferAfter  += kMtHashBlockSize;

                if (!base.MatchFinder_Create(historySize, keepAddBufferBefore, matchMaxLen, keepAddBufferAfter, alloc))
                {
                    return(SZ_ERROR_MEM);
                }

                SRes res;

                if ((res = mHashSync.MtSync_Create(HashThreadFunc, "LZMA Hash Thread", kMtHashNumBlocks)) != SZ_OK)
                {
                    return(res);
                }
                if ((res = mBtSync.MtSync_Create(BtThreadFunc, "LZMA BT Thread", kMtBtNumBlocks)) != SZ_OK)
                {
                    return(res);
                }
                return(SZ_OK);
            }
コード例 #3
0
ファイル: LzFindMt.cs プロジェクト: jolhe006/managed-lzma
            internal SRes MatchFinderMt_Create(uint historySize, uint keepAddBufferBefore, uint matchMaxLen, uint keepAddBufferAfter, ISzAlloc alloc)
            {
                mLocalHistorySize = historySize;

                if(kMtBtBlockSize <= matchMaxLen * 4)
                    return SZ_ERROR_PARAM;

                if(mHashBuf == null)
                {
                    mHashBuf = alloc.AllocUInt32(alloc, kHashBufferSize + kBtBufferSize);
                    if(mHashBuf == null)
                        return SZ_ERROR_MEM;

                    mBtBuf = P.From(mHashBuf, kHashBufferSize);
                }

                keepAddBufferBefore += (kHashBufferSize + kBtBufferSize);
                keepAddBufferAfter += kMtHashBlockSize;

                if(!base.MatchFinder_Create(historySize, keepAddBufferBefore, matchMaxLen, keepAddBufferAfter, alloc))
                    return SZ_ERROR_MEM;

                SRes res;
                if((res = mHashSync.MtSync_Create(HashThreadFunc, "LZMA Hash Thread", kMtHashNumBlocks)) != SZ_OK)
                    return res;
                if((res = mBtSync.MtSync_Create(BtThreadFunc, "LZMA BT Thread", kMtBtNumBlocks)) != SZ_OK)
                    return res;
                return SZ_OK;
            }
コード例 #4
0
ファイル: LzFind.cs プロジェクト: guocqforc/managed-lzma
            private static uint[] AllocRefs(uint num, ISzAlloc alloc)
            {
                long sizeInBytes = (long)num * sizeof(uint);
                if (sizeInBytes / sizeof(uint) != num)
                    return null;

                return alloc.AllocUInt32(alloc, num);
            }