| 133 | } |
| 134 | |
| 135 | inline 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 | |
| 148 | inline uint32_t read_u32_network_order(const unsigned char *buf) |
| 149 | { |
no test coverage detected