From 8b311b5a0710c51ce5243bfdd9b8650198d6a1c3 Mon Sep 17 00:00:00 2001 From: tickduan <417921451@qq.com> Date: Thu, 8 Jul 2021 21:10:54 +0800 Subject: [PATCH] inline other modify --- deps/SZ/sz/src/CompressElement.c | 22 +++++++++++----------- deps/SZ/sz/src/DynamicByteArray.c | 7 ++++--- deps/SZ/sz/src/DynamicIntArray.c | 3 ++- deps/SZ/sz/src/TypeManager.c | 2 +- deps/SZ/sz/src/dataCompression.c | 10 +++++----- deps/SZ/sz/src/sz.c | 12 +----------- deps/SZ/sz/src/sz_double.c | 2 +- 7 files changed, 25 insertions(+), 33 deletions(-) diff --git a/deps/SZ/sz/src/CompressElement.c b/deps/SZ/sz/src/CompressElement.c index 50660989f4..b71ff9638e 100644 --- a/deps/SZ/sz/src/CompressElement.c +++ b/deps/SZ/sz/src/CompressElement.c @@ -19,7 +19,7 @@ #include "CompressElement.h" -inline short computeGroupNum_float(float value) +INLINE short computeGroupNum_float(float value) { short expo = getExponent_float(value); if(expo < 0) @@ -27,7 +27,7 @@ inline short computeGroupNum_float(float value) return expo; } -inline short computeGroupNum_double(double value) +INLINE short computeGroupNum_double(double value) { short expo = getExponent_double(value); if(expo < 0) @@ -40,35 +40,35 @@ inline short computeGroupNum_double(double value) * @param last3CmprsData buffer * @param value the value to be added to the buffer * */ -inline void listAdd_double(double last3CmprsData[3], double value) +INLINE void listAdd_double(double last3CmprsData[3], double value) { last3CmprsData[2] = last3CmprsData[1]; last3CmprsData[1] = last3CmprsData[0]; last3CmprsData[0] = value; } -inline void listAdd_float(float last3CmprsData[3], float value) +INLINE void listAdd_float(float last3CmprsData[3], float value) { last3CmprsData[2] = last3CmprsData[1]; last3CmprsData[1] = last3CmprsData[0]; last3CmprsData[0] = value; } -inline void listAdd_int(int64_t last3CmprsData[3], int64_t value) +INLINE void listAdd_int(int64_t last3CmprsData[3], int64_t value) { last3CmprsData[2] = last3CmprsData[1]; last3CmprsData[1] = last3CmprsData[0]; last3CmprsData[0] = value; } -inline void listAdd_int32(int32_t last3CmprsData[3], int32_t value) +INLINE void listAdd_int32(int32_t last3CmprsData[3], int32_t value) { last3CmprsData[2] = last3CmprsData[1]; last3CmprsData[1] = last3CmprsData[0]; last3CmprsData[0] = value; } -inline void listAdd_float_group(float *groups, int *flags, char groupNum, float oriValue, float decValue, char* curGroupID) +INLINE void listAdd_float_group(float *groups, int *flags, char groupNum, float oriValue, float decValue, char* curGroupID) { if(groupNum>=0) { @@ -88,7 +88,7 @@ inline void listAdd_float_group(float *groups, int *flags, char groupNum, float *curGroupID = -(groupNum+2); //-[-1,0,1,2,3,....,16] is mapped to [-1,-2,....,-18] } -inline void listAdd_double_group(double *groups, int *flags, char groupNum, double oriValue, double decValue, char* curGroupID) +INLINE void listAdd_double_group(double *groups, int *flags, char groupNum, double oriValue, double decValue, char* curGroupID) { if(groupNum>=0) { @@ -112,7 +112,7 @@ inline void listAdd_double_group(double *groups, int *flags, char groupNum, doub * Determine whether the prediction value minErr is valid. * * */ -inline int validPrediction_double(double minErr, double precision) +INLINE int validPrediction_double(double minErr, double precision) { if(minErr<=precision) return 1; @@ -120,7 +120,7 @@ inline int validPrediction_double(double minErr, double precision) return 0; } -inline int validPrediction_float(float minErr, float precision) +INLINE int validPrediction_float(float minErr, float precision) { if(minErr<=precision) return 1; @@ -204,7 +204,7 @@ void updateLossyCompElement_Double(unsigned char* curBytes, unsigned char* preBy lce->residualMidBits = resiBits; } -inline void updateLossyCompElement_Float(unsigned char* diffBytes, unsigned char* preDiffBytes, +INLINE void updateLossyCompElement_Float(unsigned char* diffBytes, unsigned char* preDiffBytes, int reqBytesLength, int resiBitsLength, LossyCompressionElement *lce) { int resiIndex, intMidBytes_Length = 0; diff --git a/deps/SZ/sz/src/DynamicByteArray.c b/deps/SZ/sz/src/DynamicByteArray.c index 64b7d5c7b4..40fa5548ba 100644 --- a/deps/SZ/sz/src/DynamicByteArray.c +++ b/deps/SZ/sz/src/DynamicByteArray.c @@ -11,6 +11,7 @@ #include #include #include "DynamicByteArray.h" +#include "sz.h" void new_DBA(DynamicByteArray **dba, size_t cap) { *dba = (DynamicByteArray *)malloc(sizeof(DynamicByteArray)); @@ -35,7 +36,7 @@ void free_DBA(DynamicByteArray *dba) free(dba); } -inline unsigned char getDBA_Data(DynamicByteArray *dba, size_t pos) +INLINE unsigned char getDBA_Data(DynamicByteArray *dba, size_t pos) { if(pos>=dba->size) { @@ -45,7 +46,7 @@ inline unsigned char getDBA_Data(DynamicByteArray *dba, size_t pos) return dba->array[pos]; } -inline void addDBA_Data(DynamicByteArray *dba, unsigned char value) +INLINE void addDBA_Data(DynamicByteArray *dba, unsigned char value) { if(dba->size==dba->capacity) { @@ -56,7 +57,7 @@ inline void addDBA_Data(DynamicByteArray *dba, unsigned char value) dba->size ++; } -inline void memcpyDBA_Data(DynamicByteArray *dba, unsigned char* data, size_t length) +INLINE void memcpyDBA_Data(DynamicByteArray *dba, unsigned char* data, size_t length) { if(dba->size + length > dba->capacity) { diff --git a/deps/SZ/sz/src/DynamicIntArray.c b/deps/SZ/sz/src/DynamicIntArray.c index 347e3a1808..d9e7a2a89a 100644 --- a/deps/SZ/sz/src/DynamicIntArray.c +++ b/deps/SZ/sz/src/DynamicIntArray.c @@ -11,6 +11,7 @@ #include #include #include "DynamicIntArray.h" +#include "sz.h" void new_DIA(DynamicIntArray **dia, size_t cap) { *dia = (DynamicIntArray *)malloc(sizeof(DynamicIntArray)); @@ -45,7 +46,7 @@ int getDIA_Data(DynamicIntArray *dia, size_t pos) return dia->array[pos]; } -inline void addDIA_Data(DynamicIntArray *dia, int value) +INLINE void addDIA_Data(DynamicIntArray *dia, int value) { if(dia->size==dia->capacity) { diff --git a/deps/SZ/sz/src/TypeManager.c b/deps/SZ/sz/src/TypeManager.c index dcdda19f75..6c2e0a838c 100644 --- a/deps/SZ/sz/src/TypeManager.c +++ b/deps/SZ/sz/src/TypeManager.c @@ -151,7 +151,7 @@ size_t convertIntArray2ByteArray_fast_2b(unsigned char* timeStepType, size_t tim return byteLength; } -inline int getLeftMovingSteps(size_t k, unsigned char resiBitLength) +INLINE int getLeftMovingSteps(size_t k, unsigned char resiBitLength) { return 8 - k%8 - resiBitLength; } diff --git a/deps/SZ/sz/src/dataCompression.c b/deps/SZ/sz/src/dataCompression.c index 3c32878bb4..6aa1348774 100644 --- a/deps/SZ/sz/src/dataCompression.c +++ b/deps/SZ/sz/src/dataCompression.c @@ -177,14 +177,14 @@ void symTransform_8bytes(unsigned char data[8]) data[4] = tmp; } -inline void symTransform_2bytes(unsigned char data[2]) +INLINE void symTransform_2bytes(unsigned char data[2]) { unsigned char tmp = data[0]; data[0] = data[1]; data[1] = tmp; } -inline void symTransform_4bytes(unsigned char data[4]) +INLINE void symTransform_4bytes(unsigned char data[4]) { unsigned char tmp = data[0]; data[0] = data[3]; @@ -195,7 +195,7 @@ inline void symTransform_4bytes(unsigned char data[4]) data[2] = tmp; } -inline void compressSingleFloatValue(FloatValueCompressElement *vce, float oriValue, float precision, float medianValue, +INLINE void compressSingleFloatValue(FloatValueCompressElement *vce, float oriValue, float precision, float medianValue, int reqLength, int reqBytesLength, int resiBitsLength) { lfloat diffVal; @@ -255,7 +255,7 @@ int compIdenticalLeadingBytesCount_double(unsigned char* preBytes, unsigned char return n; } -inline int compIdenticalLeadingBytesCount_float(unsigned char* preBytes, unsigned char* curBytes) +INLINE int compIdenticalLeadingBytesCount_float(unsigned char* preBytes, unsigned char* curBytes) { int i, n = 0; for(i=0;i<4;i++) @@ -268,7 +268,7 @@ inline int compIdenticalLeadingBytesCount_float(unsigned char* preBytes, unsigne } //TODO double-check the correctness... -inline void addExactData(DynamicByteArray *exactMidByteArray, DynamicIntArray *exactLeadNumArray, +INLINE void addExactData(DynamicByteArray *exactMidByteArray, DynamicIntArray *exactLeadNumArray, DynamicIntArray *resiBitArray, LossyCompressionElement *lce) { int i; diff --git a/deps/SZ/sz/src/sz.c b/deps/SZ/sz/src/sz.c index 4d3b0adbbe..9c88da1526 100644 --- a/deps/SZ/sz/src/sz.c +++ b/deps/SZ/sz/src/sz.c @@ -163,18 +163,8 @@ void SZ_Finalize() #ifdef WINDOWS #include +int gettimeofday(struct timeval *tv, struct timezone *tz); -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 #endif diff --git a/deps/SZ/sz/src/sz_double.c b/deps/SZ/sz/src/sz_double.c index e04c6f0205..91ed431849 100644 --- a/deps/SZ/sz/src/sz_double.c +++ b/deps/SZ/sz/src/sz_double.c @@ -30,7 +30,7 @@ unsigned char* SZ_skip_compress_double(double* data, size_t dataLength, size_t* return out; } -inline void computeReqLength_double(double realPrecision, short radExpo, int* reqLength, double* medianValue) +INLINE void computeReqLength_double(double realPrecision, short radExpo, int* reqLength, double* medianValue) { short reqExpo = getPrecisionReqLength_double(realPrecision); *reqLength = 12+radExpo - reqExpo; //radExpo-reqExpo == reqMantiLength -- GitLab