10 R->HighPart =
A.HighPart -
B.HighPart;
11 if (
A.LowPart >=
B.LowPart)
12 R->LowPart =
A.LowPart -
B.LowPart;
15 R->LowPart =
A.LowPart -
B.LowPart;
22 unsigned __int64 __rdtsc(
void);
26 pbeginTime64->QuadPart=__rdtsc();
29 LARGE_INTEGER
GetResRdtsc(LARGE_INTEGER beginTime64,BOOL fComputeTimeQueryPerf)
32 unsigned _int64 res=__rdtsc()-((
unsigned _int64)(beginTime64.QuadPart));
48 pbeginTime64->LowPart=dwEax;
49 pbeginTime64->HighPart=dwEdx;
57 LARGE_INTEGER
GetResRdtsc(LARGE_INTEGER beginTime64,BOOL fComputeTimeQueryPerf)
59 LARGE_INTEGER LIres,endTime64;
62 LIres.LowPart=LIres.HighPart=0;
75 LARGE_INTEGER
GetResRdtsc(LARGE_INTEGER beginTime64,BOOL fComputeTimeQueryPerf)
86 if ((!fComputeTimeQueryPerf) || (!QueryPerformanceCounter(pbeginTime64)))
88 pbeginTime64->LowPart = GetTickCount();
89 pbeginTime64->HighPart = 0;
95 LARGE_INTEGER endTime64,ticksPerSecond,ticks;
96 DWORDLONG ticksShifted,tickSecShifted;
99 if ((!fComputeTimeQueryPerf) || (!QueryPerformanceCounter(&endTime64)))
100 dwRet = (GetTickCount() - beginTime64.LowPart)*1;
104 QueryPerformanceFrequency(&ticksPerSecond);
108 ticksShifted = Int64ShrlMod32(*(DWORDLONG*)&ticks,dwLog);
109 tickSecShifted = Int64ShrlMod32(*(DWORDLONG*)&ticksPerSecond,dwLog);
130 *plFileSize=ftell(
stream);
132 ptr=
malloc((*plFileSize)+1);
137 if (fread(ptr, 1, *plFileSize,
stream) != (*plFileSize))
147 int BlockSizeCompress=0x8000;
148 int BlockSizeUncompress=0x8000;
151 unsigned char* FilePtr;
153 long lBufferSizeUncpr;
154 long lCompressedSize=0;
155 unsigned char* CprPtr;
156 unsigned char* UncprPtr;
157 long lSizeCpr,lSizeUncpr;
158 DWORD dwGetTick,dwMsecQP;
159 LARGE_INTEGER li_qp,li_rdtsc,dwResRdtsc;
163 printf(
"run TestZlib <File> [BlockSizeCompress] [BlockSizeUncompress] [compres. level]\n");
172 else printf(
"file %s read, %u bytes\n",
argv[1],lFileSize);
175 BlockSizeCompress=atol(
argv[2]);
178 BlockSizeUncompress=atol(
argv[3]);
183 lBufferSizeCpr = lFileSize + (lFileSize/0x10) + 0x200;
184 lBufferSizeUncpr = lBufferSizeCpr;
186 CprPtr=(
unsigned char*)
malloc(lBufferSizeCpr + BlockSizeCompress);
189 dwGetTick=GetTickCount();
194 long lOrigToDo = lFileSize;
206 long all_read_before = zcpr.
total_in;
210 lOrigDone += (zcpr.
total_in-all_read_before);
211 lOrigToDo -= (zcpr.
total_in-all_read_before);
217 dwGetTick=GetTickCount()-dwGetTick;
220 printf(
"total compress size = %u, in %u step\n",lSizeCpr,
step);
221 printf(
"time = %u msec = %f sec\n",dwGetTick,dwGetTick/(
double)1000.);
222 printf(
"defcpr time QP = %u msec = %f sec\n",dwMsecQP,dwMsecQP/(
double)1000.);
223 printf(
"defcpr result rdtsc = %I64x\n\n",dwResRdtsc.QuadPart);
226 CprPtr=(
unsigned char*)
realloc(CprPtr,lSizeCpr);
227 UncprPtr=(
unsigned char*)
malloc(lBufferSizeUncpr + BlockSizeUncompress);
230 dwGetTick=GetTickCount();
235 long lOrigToDo = lSizeCpr;
247 long all_read_before = zcpr.
total_in;
248 zcpr.
avail_in =
min(lOrigToDo,BlockSizeUncompress);
251 lOrigDone += (zcpr.
total_in-all_read_before);
252 lOrigToDo -= (zcpr.
total_in-all_read_before);
258 dwGetTick=GetTickCount()-dwGetTick;
261 printf(
"total uncompress size = %u, in %u step\n",lSizeUncpr,
step);
262 printf(
"time = %u msec = %f sec\n",dwGetTick,dwGetTick/(
double)1000.);
263 printf(
"uncpr time QP = %u msec = %f sec\n",dwMsecQP,dwMsecQP/(
double)1000.);
264 printf(
"uncpr result rdtsc = %I64x\n\n",dwResRdtsc.QuadPart);
267 if (lSizeUncpr==lFileSize)
269 if (memcmp(FilePtr,UncprPtr,lFileSize)==0)
static RzILOpEffect * mov(cs_insn *insn, bool is_thumb)
_Use_decl_annotations_ int __cdecl printf(const char *const _Format,...)
int ZEXPORT deflateEnd(z_streamp strm)
int ZEXPORT deflate(z_streamp strm, int flush)
static states step(struct re_guts *, sopno, sopno, states, int, states)
int ZEXPORT inflate(z_streamp strm, int flush)
int ZEXPORT inflateEnd(z_streamp strm)
return memset(p, 0, total)
void * realloc(void *ptr, size_t size)
void * malloc(size_t size)
static static fork const void static count static fd const char const char static newpath char char argv
int main(int argc, char *argv[])
void myGetRDTSC32(LARGE_INTEGER *pbeginTime64)
void BeginCountRdtsc(LARGE_INTEGER *pbeginTime64)
void MyDoMinus64(LARGE_INTEGER *R, LARGE_INTEGER A, LARGE_INTEGER B)
DWORD GetMsecSincePerfCounter(LARGE_INTEGER beginTime64, BOOL fComputeTimeQueryPerf)
void BeginCountPerfCounter(LARGE_INTEGER *pbeginTime64, BOOL fComputeTimeQueryPerf)
int ReadFileMemory(const char *filename, long *plFileSize, unsigned char **pFilePtr)
LARGE_INTEGER GetResRdtsc(LARGE_INTEGER beginTime64, BOOL fComputeTimeQueryPerf)
#define inflateInit(strm)
#define deflateInit(strm, level)
#define Z_DEFAULT_COMPRESSION