Master Core  v0.0.9 - 2abfd2849db8ba7a83957c64eb976b406713c123
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
mastercore_convert.h
Go to the documentation of this file.
1 #ifndef _MASTERCORE_CONVERT
2 #define _MASTERCORE_CONVERT
3 
4 #include <stdint.h>
5 
6 namespace mastercore
7 {
8 
15 uint64_t rounduint64(long double);
16 
21 void swapByteOrder16(uint16_t&);
22 void swapByteOrder32(uint32_t&);
23 void swapByteOrder64(uint64_t&);
24 
28 #define PUSH_BACK_BYTES(vector, value)\
29  vector.insert(vector.end(), reinterpret_cast<unsigned char *>(&(value)),\
30  reinterpret_cast<unsigned char *>(&(value)) + sizeof((value)));
31 
35 #define PUSH_BACK_BYTES_PTR(vector, ptr, size)\
36  vector.insert(vector.end(), reinterpret_cast<unsigned char *>((ptr)),\
37  reinterpret_cast<unsigned char *>((ptr)) + (size));
38 }
39 
40 #endif // _MASTERCORE_CONVERT
void swapByteOrder16(uint16_t &us)
Swaps byte order on little-endian systems and does nothing otherwise.
void swapByteOrder32(uint32_t &ui)
uint64_t rounduint64(long double ld)
Converts numbers to 64 bit wide unsigned integer whereby any signedness is ignored.
void swapByteOrder64(uint64_t &ull)