MCPcopy Create free account
hub / github.com/BehaviorTree/BehaviorTree.CPP / write_network_order

Function write_network_order

3rdparty/cppzmq/zmq_addon.hpp:135–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133}
134
135inline void write_network_order(unsigned char *buf, const uint32_t value)
136{
137 if (is_little_endian()) {
138 ZMQ_CONSTEXPR_VAR uint32_t mask = (std::numeric_limits<std::uint8_t>::max)();
139 *buf++ = static_cast<unsigned char>((value >> 24) & mask);
140 *buf++ = static_cast<unsigned char>((value >> 16) & mask);
141 *buf++ = static_cast<unsigned char>((value >> 8) & mask);
142 *buf++ = static_cast<unsigned char>(value & mask);
143 } else {
144 std::memcpy(buf, &value, sizeof(value));
145 }
146}
147
148inline uint32_t read_u32_network_order(const unsigned char *buf)
149{

Callers 1

encodeFunction · 0.85

Calls 1

is_little_endianFunction · 0.85

Tested by

no test coverage detected