/** * @file ByteToolkit.h * @author Sheng Di * @date July, 2017 * @brief Header file for the ByteToolkit.c. * (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory. * See COPYRIGHT in top-level directory. */ #ifndef _ByteToolkit_H #define _ByteToolkit_H #ifdef __cplusplus extern "C" { #endif #include int bytesToInt_bigEndian(unsigned char* bytes); void intToBytes_bigEndian(unsigned char *b, unsigned int num); long bytesToLong_bigEndian(unsigned char* b); void longToBytes_bigEndian(unsigned char *b, long num); short getExponent_float(float value); short getPrecisionReqLength_float(float precision); short getExponent_double(double value); short getPrecisionReqLength_double(double precision); float bytesToFloat(unsigned char* bytes); void floatToBytes(unsigned char *b, float num); double bytesToDouble(unsigned char* bytes); void doubleToBytes(unsigned char *b, double num); int getMaskRightCode(int m); int getLeftMovingCode(int kMod8); int getRightMovingSteps(int kMod8, int resiBitLength); int getRightMovingCode(int kMod8, int resiBitLength); size_t bytesToSize(unsigned char* bytes, int size_type); void sizeToBytes(unsigned char* outBytes, size_t size, int size_type); #ifdef __cplusplus } #endif #endif /* ----- #ifndef _ByteToolkit_H ----- */