1 #ifndef CONVERSION_UTILITIES_CONVERT_H
2 #define CONVERSION_UTILITIES_CONVERT_H
6 #include "../application/global.h"
8 #if defined(__BYTE_ORDER__) && defined(__FLOAT_WORD_ORDER__)
9 # if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
10 # define CONVERSION_UTILITIES_BYTE_ORDER_BIG_ENDIAN
11 # elif __BYTE_ORDER__ == __ORDER_PDP_ENDIAN__
12 # define CONVERSION_UTILITIES_BYTE_ORDER_MIDDLE_ENDIAN
13 # elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
14 # define CONVERSION_UTILITIES_BYTE_ORDER_LITTLE_ENDIAN
16 # if __FLOAT_WORD_ORDER__ == __ORDER_BIG_ENDIAN__
17 # define CONVERSION_UTILITIES_FLOAT_BYTE_ORDER_BIG_ENDIAN
18 # elif __FLOAT_WORD_ORDER__ == __ORDER_PDP_ENDIAN__
19 # define CONVERSION_UTILITIES_FLOAT_BYTE_ORDER_MIDDLE_ENDIAN
20 # elif __FLOAT_WORD_ORDER__ == __ORDER_LITTLE_ENDIAN__
21 # define CONVERSION_UTILITIES_FLOAT_BYTE_ORDER_LITTLE_ENDIAN
23 #elif defined(__i386) || defined(__i386__) || defined(_M_IX86) || defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64) || defined(__LITTLE_ENDIAN__) || defined(_little_endian__) || defined(_LITTLE_ENDIAN) || defined(_WIN32_WCE) || defined(WINAPI_FAMILY)
24 # define CONVERSION_UTILITIES_BYTE_ORDER_LITTLE_ENDIAN
25 # define CONVERSION_UTILITIES_FLOAT_BYTE_ORDER_LITTLE_ENDIAN
26 #elif defined(__MIPSEB__) || defined(__s390__) || defined(__BIG_ENDIAN__) || defined(_big_endian__) || defined(_BIG_ENDIAN)
27 # define CONVERSION_UTILITIES_BYTE_ORDER_BIG_ENDIAN
28 # define CONVERSION_UTILITIES_FLOAT_BYTE_ORDER_BIG_ENDIAN
30 # error "Unable to determine byte order!"
71 #endif // CONVERSION_UTILITIES_CONVERT_H
void getBytes(int16 value, char *outputbuffer, int startIndex, ByteOrder byteOrder)
Stores the specified 16-bit signed integer value at a specified position in a char array...
ByteOrder
Specifies the byte order/endianness.
std::int64_t int64
signed 64-bit integer
float64 toFloat64(const char *value, int startIndex, ByteOrder byteOrder)
Returns a 64-bit floating point number converted from eight bytes at a specified position in a char a...
uint32 toNormalInt(uint32 synchsafeInt)
Returns a normal 32-bit integer converted from a 32-bit synchsafe integer.
#define LIB_EXPORT
This macro marks a symbol for shared library export.
int16 toInt16(const char *value, int startIndex, ByteOrder byteOrder)
Returns a 16-bit signed integer converted from two bytes at a specified position in a char array...
std::uint64_t uint64
unsigned 64-bit integer
float32 toFloat32(const char *value, int startIndex, ByteOrder byteOrder)
Returns a 32-bit floating point number converted from four bytes at a specified position in a char ar...
uint32 toUInt24(const char *value, int startIndex, ByteOrder byteOrder)
Returns a 32-bit unsigned integer converted from three bytes at a specified position in a char array...
Contains several functions providing conversions between different data types.
std::uint32_t uint32
unsigned 32-bit integer
uint32 toSynchsafeInt(uint32 normalInt)
Returns a 32-bit synchsafe integer converted from a normal 32-bit integer.
uint64 toUInt64(const char *value, int startIndex, ByteOrder byteOrder)
Returns a 64-bit unsigned integer converted from eight bytes at a specified position in a char array...
std::int32_t int32
signed 32-bit integer
int32 toInt32(const char *value, int startIndex, ByteOrder byteOrder)
Returns a 32-bit signed integer converted from four bytes at a specified position in a char array...
uint32 toUInt32(const char *value, int startIndex, ByteOrder byteOrder)
Returns a 32-bit unsigned integer converted from four bytes at a specified position in a char array...
std::int16_t int16
signed 16-bit integer
uint16 toUInt16(const char *value, int startIndex, ByteOrder byteOrder)
Returns a 16-bit unsigned integer converted from two bytes at a specified position in a char array...
std::uint16_t uint16
unsigned 16-bit integer
int64 toInt64(const char *value, int startIndex, ByteOrder byteOrder)
Returns a 64-bit signed integer converted from eight bytes at a specified position in a char array...