X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=code%2Fstage1%2Fsrc%2FUtil%2Futils.c;h=91ea07595e973611e81c115e4853ac8b36262a9f;hb=73d68777d709e054cf74e806e23b0bdefda9462a;hp=efd4dd2fe8d08f335574aa44e5ce018fc1fc4cc6;hpb=f9f51b6ab4c7280dd521da675353252d7b078984;p=epclust.git diff --git a/code/stage1/src/Util/utils.c b/code/stage1/src/Util/utils.c index efd4dd2..91ea075 100644 --- a/code/stage1/src/Util/utils.c +++ b/code/stage1/src/Util/utils.c @@ -30,7 +30,7 @@ char readInt(FILE* stream, int64_t* integer) return curChar; } -char readReal(FILE* stream, Real* real) +char readReal(FILE* stream, float* real) { int64_t integerPart; char nextChar = readInt(stream, &integerPart); @@ -51,8 +51,8 @@ char readReal(FILE* stream, Real* real) if (nextChar == 'e' || nextChar == 'E') nextChar = readInt(stream, &exponent); int64_t divisorForFractional = pow(10, floor(log10(fractionalPart > 0 ? fractionalPart : 1))+1); - *real = ( (Real)integerPart - + (integerPart < 0 ? -1 : 1) * (Real)fractionalPart/(divisorForFractional*pow(10,countZeros)) ) + *real = ( (float)integerPart + + (integerPart < 0 ? -1 : 1) * (float)fractionalPart/(divisorForFractional*pow(10,countZeros)) ) * pow(10,exponent); return nextChar; } @@ -79,7 +79,7 @@ void write_int(uint32_t x, Byte* buffer) //WARNING: assuming float is 32bits... // convert 4-bytes binary float to float -float bReal_to_double(Byte* pFloat) +float bReal_to_float(Byte* pFloat) { float res; memcpy(&res, pFloat, 4); @@ -121,7 +121,7 @@ uint32_t get_nbSeries(const char* ifileName) if (lengthRead != 1) fprintf(stderr,"Warning: getting nbSeries from truncated binary file.\n"); fclose(ifile); - return bInt_to_uint(binaryInt, 4); + return bInt_to_uint(binaryInt); } // get metadata: tsLength @@ -134,5 +134,5 @@ uint32_t get_tsLength(const char* ifileName) if (lengthRead != 1) fprintf(stderr,"Warning: getting tsLength from truncated binary file.\n"); fclose(ifile); - return bInt_to_uint(binaryInt, 4); + return bInt_to_uint(binaryInt); }