提交 9b720e07 编写于 作者: T tickduan

compatible windows os

上级 ddcd211f
...@@ -26,8 +26,7 @@ short getExponent_float(float value); ...@@ -26,8 +26,7 @@ short getExponent_float(float value);
short getPrecisionReqLength_float(float precision); short getPrecisionReqLength_float(float precision);
short getExponent_double(double value); short getExponent_double(double value);
short getPrecisionReqLength_double(double precision); short getPrecisionReqLength_double(double precision);
unsigned char numberOfLeadingZeros_Int(int i);
unsigned char numberOfLeadingZeros_Long(long i);
float bytesToFloat(unsigned char* bytes); float bytesToFloat(unsigned char* bytes);
void floatToBytes(unsigned char *b, float num); void floatToBytes(unsigned char *b, float num);
double bytesToDouble(unsigned char* bytes); double bytesToDouble(unsigned char* bytes);
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h>
/*--------------------------------------------------------------------------- /*---------------------------------------------------------------------------
New types New types
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdint.h> #include <stdint.h>
#include <sys/time.h> /* For gettimeofday(), in microseconds */
#include <time.h> /* For time(), in seconds */ #include <time.h> /* For time(), in seconds */
#include "pub.h" #include "pub.h"
#include "CompressElement.h" #include "CompressElement.h"
......
...@@ -138,7 +138,7 @@ int SZ_ReadConf(const char* sz_cfgFile) { ...@@ -138,7 +138,7 @@ int SZ_ReadConf(const char* sz_cfgFile) {
// default option // default option
if(sz_cfgFile == NULL || access(sz_cfgFile, F_OK) != 0) if(sz_cfgFile == NULL)
{ {
dataEndianType = LITTLE_ENDIAN_DATA; dataEndianType = LITTLE_ENDIAN_DATA;
setDefaulParams(exe_params, confparams_cpr); setDefaulParams(exe_params, confparams_cpr);
...@@ -146,12 +146,6 @@ int SZ_ReadConf(const char* sz_cfgFile) { ...@@ -146,12 +146,6 @@ int SZ_ReadConf(const char* sz_cfgFile) {
return SZ_SUCCESS; return SZ_SUCCESS;
} }
if (access(sz_cfgFile, F_OK) != 0)
{
printf("[SZ] Configuration file NOT accessible.\n");
return SZ_FAILED;
}
//printf("[SZ] Reading SZ configuration file (%s) ...\n", sz_cfgFile); //printf("[SZ] Reading SZ configuration file (%s) ...\n", sz_cfgFile);
ini = iniparser_load(sz_cfgFile); ini = iniparser_load(sz_cfgFile);
if (ini == NULL) if (ini == NULL)
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h>
#include "sz.h" #include "sz.h"
#include "DynamicByteArray.h" #include "DynamicByteArray.h"
#include "DynamicIntArray.h" #include "DynamicIntArray.h"
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h>
/** Maximum value size for integers and doubles. */ /** Maximum value size for integers and doubles. */
#define MAXVALSZ 1024 #define MAXVALSZ 1024
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h>
#include "sz.h" #include "sz.h"
#include "CompressElement.h" #include "CompressElement.h"
#include "DynamicByteArray.h" #include "DynamicByteArray.h"
...@@ -21,6 +20,7 @@ ...@@ -21,6 +20,7 @@
#include "conf.h" #include "conf.h"
#include "utility.h" #include "utility.h"
//#include "CurveFillingCompressStorage.h" //#include "CurveFillingCompressStorage.h"
unsigned char versionNumber = DATA_FROMAT_VER1; unsigned char versionNumber = DATA_FROMAT_VER1;
...@@ -170,14 +170,27 @@ void modulePath(char *buf, int size) ...@@ -170,14 +170,27 @@ void modulePath(char *buf, int size)
pos[1]=0; pos[1]=0;
} }
#ifdef WINDOWS
int gettimeofday(struct timeval *tv, struct timezone *tz) {
time_t t;
t = time(NULL);
SYSTEMTIME st;
GetLocalTime(&st);
tv->tv_sec = (long)t;
tv->tv_usec = st.wMilliseconds * 1000;
return 0;
}
#else
#include <sys/time.h>
#endif
struct timeval startTime; struct timeval startTime;
struct timeval endTime; /* Start and end times */ struct timeval endTime; /* Start and end times */
struct timeval costStart; /*only used for recording the cost*/ struct timeval costStart; /*only used for recording the cost*/
double totalCost = 0; double totalCost = 0;
void cost_start() void cost_start()
{ {
totalCost = 0; totalCost = 0;
...@@ -201,3 +214,4 @@ void show_rate(int in_len, int out_len) ...@@ -201,3 +214,4 @@ void show_rate(int in_len, int out_len)
float rate=100*(float)out_len/(float)in_len; float rate=100*(float)out_len/(float)in_len;
printf(" in_len=%d out_len=%d compress rate=%.4f%%\n", in_len, out_len, rate); printf(" in_len=%d out_len=%d compress rate=%.4f%%\n", in_len, out_len, rate);
} }
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h>
#include <math.h> #include <math.h>
#include "sz.h" #include "sz.h"
#include "CompressElement.h" #include "CompressElement.h"
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h>
#include <math.h> #include <math.h>
#include "sz.h" #include "sz.h"
#include "CompressElement.h" #include "CompressElement.h"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册