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)); }
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); }
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; }
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); }