inline other modify
This commit is contained in:
parent
98898dc568
commit
8b311b5a07
|
@ -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;
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#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)
|
||||
{
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#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)
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -163,18 +163,8 @@ void SZ_Finalize()
|
|||
|
||||
#ifdef WINDOWS
|
||||
#include <windows.h>
|
||||
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 <sys/time.h>
|
||||
#endif
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue