1 #ifndef CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL 2 # error "Do not include binaryconversionprivate.h directly." 14 #if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0 15 return (static_cast<int16>(value[0]) << 8 & 0xFF00)
16 | (
static_cast<int16>(value[1]) & 0x00FF);
18 return (static_cast<int16>(value[1]) << 8 & 0xFF00)
19 | (static_cast<int16>(value[0]) & 0x00FF);
28 #if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0 29 return (static_cast<uint16>(value[0]) << 8 & 0xFF00)
30 | (
static_cast<uint16>(value[1]) & 0x00FF);
32 return (static_cast<uint16>(value[1]) << 8 & 0xFF00)
33 | (static_cast<uint16>(value[0]) & 0x00FF);
42 #if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0 43 return (static_cast<int32>(value[0]) << 24 & 0xFF000000)
44 | (
static_cast<int32>(value[1]) << 16 & 0x00FF0000)
45 | (
static_cast<int32>(value[2]) << 8 & 0x0000FF00)
46 | (
static_cast<int32>(value[3]) & 0x000000FF);
48 return (static_cast<int32>(value[3]) << 24 & 0xFF000000)
49 | (static_cast<int32>(value[2]) << 16 & 0x00FF0000)
50 | (static_cast<int32>(value[1]) << 8 & 0x0000FF00)
51 | (static_cast<int32>(value[0]) & 0x000000FF);
60 #if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0 61 return (static_cast<uint32>(value[0]) << 16 & 0x00FF0000)
62 | (
static_cast<uint32>(value[1]) << 8 & 0x0000FF00)
63 | (
static_cast<uint32>(value[2]) & 0x000000FF);
65 return (static_cast<uint32>(value[2]) << 16 & 0x00FF0000)
66 | (static_cast<uint32>(value[1]) << 8 & 0x0000FF00)
67 | (static_cast<uint32>(value[0]) & 0x000000FF);
76 #if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0 77 return (static_cast<uint32>(value[0]) << 24 & 0xFF000000)
78 | (
static_cast<uint32>(value[1]) << 16 & 0x00FF0000)
79 | (
static_cast<uint32>(value[2]) << 8 & 0x0000FF00)
80 | (
static_cast<uint32>(value[3]) & 0x000000FF);
82 return (static_cast<uint32>(value[3]) << 24 & 0xFF000000)
83 | (static_cast<uint32>(value[2]) << 16 & 0x00FF0000)
84 | (static_cast<uint32>(value[1]) << 8 & 0x0000FF00)
85 | (static_cast<uint32>(value[0]) & 0x000000FF);
94 #if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0 95 return (static_cast<int64>(value[0]) << 56 & 0xFF00000000000000)
96 | (
static_cast<int64>(value[1]) << 48 & 0x00FF000000000000)
97 | (
static_cast<int64>(value[2]) << 40 & 0x0000FF0000000000)
98 | (
static_cast<int64>(value[3]) << 32 & 0x000000FF00000000)
99 | (
static_cast<int64>(value[4]) << 24 & 0x00000000FF000000)
100 | (
static_cast<int64>(value[5]) << 16 & 0x0000000000FF0000)
101 | (
static_cast<int64>(value[6]) << 8 & 0x000000000000FF00)
102 | (
static_cast<int64>(value[7]) & 0x00000000000000FF);
104 return (static_cast<int64>(value[7]) << 56 & 0xFF00000000000000)
105 | (static_cast<int64>(value[6]) << 48 & 0x00FF000000000000)
106 | (static_cast<int64>(value[5]) << 40 & 0x0000FF0000000000)
107 | (static_cast<int64>(value[4]) << 32 & 0x000000FF00000000)
108 | (static_cast<int64>(value[3]) << 24 & 0x00000000FF000000)
109 | (static_cast<int64>(value[2]) << 16 & 0x0000000000FF0000)
110 | (static_cast<int64>(value[1]) << 8 & 0x000000000000FF00)
111 | (static_cast<int64>(value[0]) & 0x00000000000000FF);
120 #if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0 121 return (static_cast<uint64>(value[0]) << 56 & 0xFF00000000000000)
122 | (
static_cast<uint64>(value[1]) << 48 & 0x00FF000000000000)
123 | (
static_cast<uint64>(value[2]) << 40 & 0x0000FF0000000000)
124 | (
static_cast<uint64>(value[3]) << 32 & 0x000000FF00000000)
125 | (
static_cast<uint64>(value[4]) << 24 & 0x00000000FF000000)
126 | (
static_cast<uint64>(value[5]) << 16 & 0x0000000000FF0000)
127 | (
static_cast<uint64>(value[6]) << 8 & 0x000000000000FF00)
128 | (
static_cast<uint64>(value[7]) & 0x00000000000000FF);
130 return (static_cast<uint64>(value[7]) << 56 & 0xFF00000000000000)
131 | (static_cast<uint64>(value[6]) << 48 & 0x00FF000000000000)
132 | (static_cast<uint64>(value[5]) << 40 & 0x0000FF0000000000)
133 | (static_cast<uint64>(value[4]) << 32 & 0x000000FF00000000)
134 | (static_cast<uint64>(value[3]) << 24 & 0x00000000FF000000)
135 | (static_cast<uint64>(value[2]) << 16 & 0x0000000000FF0000)
136 | (static_cast<uint64>(value[1]) << 8 & 0x000000000000FF00)
137 | (static_cast<uint64>(value[0]) & 0x00000000000000FF);
146 #if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0 147 int32 val = toInt32(value);
148 char *c =
reinterpret_cast<char *
>(&val);
149 return *
reinterpret_cast<float32 *
>(c);
151 int32 val = toInt32(value);
152 char *c =
reinterpret_cast<char *
>(&val);
153 return *
reinterpret_cast<float32 *
>(c);
162 #if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0 163 int64 val = toInt64(value);
164 char *c =
reinterpret_cast<char *
>(&val);
165 return *
reinterpret_cast<float64*
>(c);
167 int64 val = toInt64(value);
168 char *c =
reinterpret_cast<char *
>(&val);
169 return *
reinterpret_cast<float64 *
>(c);
178 #if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0 179 outputbuffer[0] =
static_cast<char>((value >> 8) & 0xFF);
180 outputbuffer[1] =
static_cast<char>((value ) & 0xFF);
182 outputbuffer[1] =
static_cast<char>((value >> 8) & 0xFF);
183 outputbuffer[0] =
static_cast<char>((value ) & 0xFF);
192 #if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0 193 outputbuffer[0] =
static_cast<char>((value >> 8) & 0xFF);
194 outputbuffer[1] =
static_cast<char>((value ) & 0xFF);
196 outputbuffer[1] =
static_cast<char>((value >> 8) & 0xFF);
197 outputbuffer[0] =
static_cast<char>((value ) & 0xFF);
207 #if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0 208 outputbuffer[0] =
static_cast<char>((value >> 16) & 0xFF);
209 outputbuffer[1] =
static_cast<char>((value >> 8) & 0xFF);
210 outputbuffer[2] =
static_cast<char>((value ) & 0xFF);
212 outputbuffer[2] =
static_cast<char>((value >> 16) & 0xFF);
213 outputbuffer[1] =
static_cast<char>((value >> 8) & 0xFF);
214 outputbuffer[0] =
static_cast<char>((value ) & 0xFF);
223 #if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0 224 outputbuffer[0] =
static_cast<char>((value >> 24) & 0xFF);
225 outputbuffer[1] =
static_cast<char>((value >> 16) & 0xFF);
226 outputbuffer[2] =
static_cast<char>((value >> 8) & 0xFF);
227 outputbuffer[3] =
static_cast<char>((value ) & 0xFF);
229 outputbuffer[3] =
static_cast<char>((value >> 24) & 0xFF);
230 outputbuffer[2] =
static_cast<char>((value >> 16) & 0xFF);
231 outputbuffer[1] =
static_cast<char>((value >> 8) & 0xFF);
232 outputbuffer[0] =
static_cast<char>((value ) & 0xFF);
241 #if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0 242 outputbuffer[0] =
static_cast<char>((value >> 24) & 0xFF);
243 outputbuffer[1] =
static_cast<char>((value >> 16) & 0xFF);
244 outputbuffer[2] =
static_cast<char>((value >> 8) & 0xFF);
245 outputbuffer[3] =
static_cast<char>((value ) & 0xFF);
247 outputbuffer[3] =
static_cast<char>((value >> 24) & 0xFF);
248 outputbuffer[2] =
static_cast<char>((value >> 16) & 0xFF);
249 outputbuffer[1] =
static_cast<char>((value >> 8) & 0xFF);
250 outputbuffer[0] =
static_cast<char>((value ) & 0xFF);
259 #if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0 260 outputbuffer[0] =
static_cast<char>((value >> 56) & 0xFF);
261 outputbuffer[1] =
static_cast<char>((value >> 48) & 0xFF);
262 outputbuffer[2] =
static_cast<char>((value >> 40) & 0xFF);
263 outputbuffer[3] =
static_cast<char>((value >> 32) & 0xFF);
264 outputbuffer[4] =
static_cast<char>((value >> 24) & 0xFF);
265 outputbuffer[5] =
static_cast<char>((value >> 16) & 0xFF);
266 outputbuffer[6] =
static_cast<char>((value >> 8) & 0xFF);
267 outputbuffer[7] =
static_cast<char>((value ) & 0xFF);
269 outputbuffer[7] =
static_cast<char>((value >> 56) & 0xFF);
270 outputbuffer[6] =
static_cast<char>((value >> 48) & 0xFF);
271 outputbuffer[5] =
static_cast<char>((value >> 40) & 0xFF);
272 outputbuffer[4] =
static_cast<char>((value >> 32) & 0xFF);
273 outputbuffer[3] =
static_cast<char>((value >> 24) & 0xFF);
274 outputbuffer[2] =
static_cast<char>((value >> 16) & 0xFF);
275 outputbuffer[1] =
static_cast<char>((value >> 8) & 0xFF);
276 outputbuffer[0] =
static_cast<char>((value ) & 0xFF);
285 #if CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL == 0 286 outputbuffer[0] =
static_cast<char>((value >> 56) & 0xFF);
287 outputbuffer[1] =
static_cast<char>((value >> 48) & 0xFF);
288 outputbuffer[2] =
static_cast<char>((value >> 40) & 0xFF);
289 outputbuffer[3] =
static_cast<char>((value >> 32) & 0xFF);
290 outputbuffer[4] =
static_cast<char>((value >> 24) & 0xFF);
291 outputbuffer[5] =
static_cast<char>((value >> 16) & 0xFF);
292 outputbuffer[6] =
static_cast<char>((value >> 8) & 0xFF);
293 outputbuffer[7] =
static_cast<char>((value ) & 0xFF);
295 outputbuffer[7] =
static_cast<char>((value >> 56) & 0xFF);
296 outputbuffer[6] =
static_cast<char>((value >> 48) & 0xFF);
297 outputbuffer[5] =
static_cast<char>((value >> 40) & 0xFF);
298 outputbuffer[4] =
static_cast<char>((value >> 32) & 0xFF);
299 outputbuffer[3] =
static_cast<char>((value >> 24) & 0xFF);
300 outputbuffer[2] =
static_cast<char>((value >> 16) & 0xFF);
301 outputbuffer[1] =
static_cast<char>((value >> 8) & 0xFF);
302 outputbuffer[0] =
static_cast<char>((value ) & 0xFF);
311 char *c =
reinterpret_cast<char *
>(&value);
313 getBytes(i, outputbuffer);
321 char *c =
reinterpret_cast<char *
>(&value);
323 getBytes(i, outputbuffer);
326 #endif // CONVERSION_UTILITIES_BINARY_CONVERSION_INTERNAL
std::int64_t int64
signed 64-bit integer
std::uint64_t uint64
unsigned 64-bit integer
std::uint32_t uint32
unsigned 32-bit integer
std::int32_t int32
signed 32-bit integer
CPP_UTILITIES_EXPORT constexpr float32 toFloat32(uint16 fixed8value)
Returns a 32-bit floating point number converted from the specified 8.8 fixed point representation...
std::int16_t int16
signed 16-bit integer
#define CPP_UTILITIES_EXPORT
Marks the symbol to be exported by the c++utilities library.
std::uint16_t uint16
unsigned 16-bit integer