source: thirdparty/SZ/sz/include/ByteToolkit.h @ 2c47b73

Revision 2c47b73, 3.0 KB checked in by Hal Finkel <hfinkel@…>, 6 years ago (diff)

more work on adding SZ (latest version)

  • Property mode set to 100644
Line 
1/**
2 *  @file ByteToolkit.h
3 *  @author Sheng Di
4 *  @date July, 2017
5 *  @brief Header file for the ByteToolkit.c.
6 *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
7 *      See COPYRIGHT in top-level directory.
8 */
9
10#ifndef _ByteToolkit_H
11#define _ByteToolkit_H
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
17#include <stdio.h>
18
19//ByteToolkit.c
20
21unsigned short bytesToUInt16_bigEndian(unsigned char* bytes);
22unsigned int bytesToUInt32_bigEndian(unsigned char* bytes);
23unsigned long bytesToUInt64_bigEndian(unsigned char* b);
24
25short bytesToInt16_bigEndian(unsigned char* bytes);
26int bytesToInt32_bigEndian(unsigned char* bytes);
27long bytesToInt64_bigEndian(unsigned char* b);
28int bytesToInt_bigEndian(unsigned char* bytes);
29
30void intToBytes_bigEndian(unsigned char *b, unsigned int num);
31
32void int64ToBytes_bigEndian(unsigned char *b, uint64_t num);
33void int32ToBytes_bigEndian(unsigned char *b, uint32_t num);
34void int16ToBytes_bigEndian(unsigned char *b, uint16_t num);
35
36long bytesToLong_bigEndian(unsigned char* b);
37void longToBytes_bigEndian(unsigned char *b, unsigned long num);
38long doubleToOSEndianLong(double value);
39int floatToOSEndianInt(float value);
40short getExponent_float(float value);
41short getPrecisionReqLength_float(float precision);
42short getExponent_double(double value);
43short getPrecisionReqLength_double(double precision);
44unsigned char numberOfLeadingZeros_Int(int i);
45unsigned char numberOfLeadingZeros_Long(long i);
46unsigned char getLeadingNumbers_Int(int v1, int v2);
47unsigned char getLeadingNumbers_Long(long v1, long v2);
48short bytesToShort(unsigned char* bytes);
49void shortToBytes(unsigned char* b, short value);
50int bytesToInt(unsigned char* bytes);
51long bytesToLong(unsigned char* bytes);
52float bytesToFloat(unsigned char* bytes);
53void floatToBytes(unsigned char *b, float num);
54double bytesToDouble(unsigned char* bytes);
55void doubleToBytes(unsigned char *b, double num);
56int extractBytes(unsigned char* byteArray, size_t k, int validLength);
57int getMaskRightCode(int m);
58int getLeftMovingCode(int kMod8);
59int getRightMovingSteps(int kMod8, int resiBitLength);
60int getRightMovingCode(int kMod8, int resiBitLength);
61short* convertByteDataToShortArray(unsigned char* bytes, size_t byteLength);
62unsigned short* convertByteDataToUShortArray(unsigned char* bytes, size_t byteLength);
63
64void convertShortArrayToBytes(short* states, size_t stateLength, unsigned char* bytes);
65void convertUShortArrayToBytes(unsigned short* states, size_t stateLength, unsigned char* bytes);
66void convertIntArrayToBytes(int* states, size_t stateLength, unsigned char* bytes);
67void convertUIntArrayToBytes(unsigned int* states, size_t stateLength, unsigned char* bytes);
68void convertLongArrayToBytes(int64_t* states, size_t stateLength, unsigned char* bytes);
69void convertULongArrayToBytes(uint64_t* states, size_t stateLength, unsigned char* bytes);
70
71size_t bytesToSize(unsigned char* bytes);
72void sizeToBytes(unsigned char* outBytes, size_t size);
73
74#ifdef __cplusplus
75}
76#endif
77
78#endif /* ----- #ifndef _ByteToolkit_H  ----- */
79
Note: See TracBrowser for help on using the repository browser.