4.59 beta

This commit is contained in:
Igor Pavlov
2008-08-13 00:00:00 +00:00
committed by Kornel Lesiński
parent 3901bf0ab8
commit 173c07e166
781 changed files with 22124 additions and 13650 deletions

View File

@@ -28,8 +28,8 @@
#endif
#endif
extern "C"
{
extern "C"
{
#include "../../../../C/Alloc.h"
#include "../../../../C/7zCrc.h"
}
@@ -60,9 +60,9 @@ class CBaseRandomGenerator
public:
CBaseRandomGenerator() { Init(); }
void Init() { A1 = 362436069; A2 = 521288629;}
UInt32 GetRnd()
UInt32 GetRnd()
{
return
return
((A1 = 36969 * (A1 & 0xffff) + (A1 >> 16)) << 16) +
((A2 = 18000 * (A2 & 0xffff) + (A2 >> 16)) );
}
@@ -73,14 +73,14 @@ class CBenchBuffer
public:
size_t BufferSize;
Byte *Buffer;
CBenchBuffer(): Buffer(0) {}
CBenchBuffer(): Buffer(0) {}
virtual ~CBenchBuffer() { Free(); }
void Free()
{
void Free()
{
::MidFree(Buffer);
Buffer = 0;
}
bool Alloc(size_t bufferSize)
bool Alloc(size_t bufferSize)
{
if (Buffer != 0 && BufferSize == bufferSize)
return true;
@@ -96,14 +96,14 @@ class CBenchRandomGenerator: public CBenchBuffer
CBaseRandomGenerator *RG;
public:
void Set(CBaseRandomGenerator *rg) { RG = rg; }
UInt32 GetVal(UInt32 &res, int numBits)
UInt32 GetVal(UInt32 &res, int numBits)
{
UInt32 val = res & (((UInt32)1 << numBits) - 1);
res >>= numBits;
return val;
}
UInt32 GetLen(UInt32 &res)
{
UInt32 GetLen(UInt32 &res)
{
UInt32 len = GetVal(res, 2);
return GetVal(res, 1 + len);
}
@@ -145,7 +145,7 @@ public:
};
class CBenchmarkInStream:
class CBenchmarkInStream:
public ISequentialInStream,
public CMyUnknownImp
{
@@ -179,7 +179,7 @@ STDMETHODIMP CBenchmarkInStream::Read(void *data, UInt32 size, UInt32 *processed
return S_OK;
}
class CBenchmarkOutStream:
class CBenchmarkOutStream:
public ISequentialOutStream,
public CBenchBuffer,
public CMyUnknownImp
@@ -187,8 +187,8 @@ class CBenchmarkOutStream:
// bool _overflow;
public:
UInt32 Pos;
// CBenchmarkOutStream(): _overflow(false) {}
void Init()
// CBenchmarkOutStream(): _overflow(false) {}
void Init()
{
// _overflow = false;
Pos = 0;
@@ -214,7 +214,7 @@ STDMETHODIMP CBenchmarkOutStream::Write(const void *data, UInt32 size, UInt32 *p
return S_OK;
}
class CCrcOutStream:
class CCrcOutStream:
public ISequentialOutStream,
public CMyUnknownImp
{
@@ -251,7 +251,7 @@ static UInt64 GetTimeCount()
return value.QuadPart;
*/
return GetTickCount();
#endif
#endif
}
static UInt64 GetFreq()
@@ -261,7 +261,7 @@ static UInt64 GetFreq()
return 1000000;
#else
return 1;
#endif
#endif
#else
/*
LARGE_INTEGER value;
@@ -269,7 +269,7 @@ static UInt64 GetFreq()
return value.QuadPart;
*/
return 1000;
#endif
#endif
}
#ifndef USE_POSIX_TIME
@@ -284,7 +284,7 @@ static UInt64 GetUserTime()
if (::GetProcessTimes(::GetCurrentProcess(), &creationTime, &exitTime, &kernelTime, &userTime) != 0)
return GetTime64(userTime) + GetTime64(kernelTime);
return (UInt64)GetTickCount() * 10000;
#endif
#endif
}
static UInt64 GetUserFreq()
@@ -293,18 +293,18 @@ static UInt64 GetUserFreq()
return CLOCKS_PER_SEC;
#else
return 10000000;
#endif
#endif
}
class CBenchProgressStatus
{
#ifdef BENCH_MT
NWindows::NSynchronization::CCriticalSection CS;
NWindows::NSynchronization::CCriticalSection CS;
#endif
public:
HRESULT Res;
bool EncodeMode;
void SetResult(HRESULT res)
void SetResult(HRESULT res)
{
#ifdef BENCH_MT
NWindows::NSynchronization::CCriticalSectionLock lock(CS);
@@ -450,7 +450,7 @@ UInt64 GetDecompressRating(UInt64 elapsedTime, UInt64 freq, UInt64 outSize, UInt
}
#ifdef EXTERNAL_LZMA
typedef UInt32 (WINAPI * CreateObjectPointer)(const GUID *clsID,
typedef UInt32 (WINAPI * CreateObjectPointer)(const GUID *clsID,
const GUID *interfaceID, void **outObject);
#endif
@@ -571,9 +571,9 @@ HRESULT CEncoderInfo::Init(UInt32 dictionarySize, UInt32 numThreads, CBaseRandom
return E_OUTOFMEMORY;
propStreamSpec->Init();
PROPID propIDs[] =
{
NCoderPropID::kDictionarySize,
PROPID propIDs[] =
{
NCoderPropID::kDictionarySize,
NCoderPropID::kMultiThread
};
const int kNumProps = sizeof(propIDs) / sizeof(propIDs[0]);
@@ -664,13 +664,13 @@ HRESULT LzmaBench(
#endif
UInt32 numThreads, UInt32 dictionarySize, IBenchCallback *callback)
{
UInt32 numEncoderThreads =
UInt32 numEncoderThreads =
#ifdef BENCH_MT
(numThreads > 1 ? numThreads / 2 : 1);
#else
1;
#endif
UInt32 numSubDecoderThreads =
UInt32 numSubDecoderThreads =
#ifdef BENCH_MT
(numThreads > 1 ? 2 : 1);
#else
@@ -838,7 +838,7 @@ HRESULT LzmaBench(
inline UInt64 GetLZMAUsage(bool multiThread, UInt32 dictionary)
{
{
UInt32 hs = dictionary - 1;
hs |= (hs >> 1);
hs |= (hs >> 2);
@@ -849,7 +849,7 @@ inline UInt64 GetLZMAUsage(bool multiThread, UInt32 dictionary)
if (hs > (1 << 24))
hs >>= 1;
hs++;
return ((hs + (1 << 16)) + (UInt64)dictionary * 2) * 4 + (UInt64)dictionary * 3 / 2 +
return ((hs + (1 << 16)) + (UInt64)dictionary * 2) * 4 + (UInt64)dictionary * 3 / 2 +
(1 << 20) + (multiThread ? (6 << 20) : 0);
}
@@ -905,10 +905,10 @@ struct CCrcThreads
Items[i].Wait();
NumThreads = 0;
}
~CCrcThreads()
{
~CCrcThreads()
{
WaitAll();
delete []Items;
delete []Items;
}
};
#endif