MCPcopy Create free account
hub / github.com/Icinga/icinga2 / PackFloat64BE

Function PackFloat64BE

lib/base/object-packer.cpp:113–127  ·  view source on GitHub ↗

* Append the given double as big-endian IEEE 754 binary64 */

Source from the content-addressed store, hash-verified

111 * Append the given double as big-endian IEEE 754 binary64
112 */
113static inline void PackFloat64BE(double f, std::string& builder)
114{
115 Double2BytesConverter converter;
116
117 converter.f = f;
118
119 if (MACHINE_LITTLE_ENDIAN) {
120 SwapBytes(converter.buf[0], converter.buf[7]);
121 SwapBytes(converter.buf[1], converter.buf[6]);
122 SwapBytes(converter.buf[2], converter.buf[5]);
123 SwapBytes(converter.buf[3], converter.buf[4]);
124 }
125
126 builder.append((char*)converter.buf, 8);
127}
128
129/**
130 * Append the given string's length (BE uint64) and the string itself

Callers 1

PackAnyFunction · 0.85

Calls 1

SwapBytesFunction · 0.85

Tested by

no test coverage detected