Commit 61fb6752 authored by Dominik Charousset's avatar Dominik Charousset

Fix typo

parent 9396dc2d
...@@ -66,7 +66,7 @@ behavior pong() { ...@@ -66,7 +66,7 @@ behavior pong() {
// utility function for sending an integer type // utility function for sending an integer type
template <class T> template <class T>
void write_int(broker* self, connection_handle hdl, T value) { void write_int(broker* self, connection_handle hdl, T value) {
using unsigned_type = typename std::make_signed<T>::type; using unsigned_type = typename std::make_unsigned<T>::type;
auto cpy = static_cast<T>(htonl(static_cast<unsigned_type>(value))); auto cpy = static_cast<T>(htonl(static_cast<unsigned_type>(value)));
self->write(hdl, sizeof(T), &cpy); self->write(hdl, sizeof(T), &cpy);
self->flush(hdl); self->flush(hdl);
...@@ -81,7 +81,7 @@ void write_int(broker* self, connection_handle hdl, uint64_t value) { ...@@ -81,7 +81,7 @@ void write_int(broker* self, connection_handle hdl, uint64_t value) {
// utility function for reading an ingeger from incoming data // utility function for reading an ingeger from incoming data
template <class T> template <class T>
void read_int(const void* data, T& storage) { void read_int(const void* data, T& storage) {
using unsigned_type = typename std::make_signed<T>::type; using unsigned_type = typename std::make_unsigned<T>::type;
memcpy(&storage, data, sizeof(T)); memcpy(&storage, data, sizeof(T));
storage = static_cast<T>(ntohl(static_cast<unsigned_type>(storage))); storage = static_cast<T>(ntohl(static_cast<unsigned_type>(storage)));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment