Commit bd7c3c96 authored by Dominik Charousset's avatar Dominik Charousset

Fix strict-aliasing warning

parent a504e151
......@@ -58,11 +58,12 @@ struct stream_slots : detail::comparable<stream_slots>{
return {receiver, sender};
}
inline int_fast32_t compare(stream_slots other) const noexcept {
static_assert(sizeof(stream_slots) == sizeof(int32_t),
"sizeof(stream_slots) != sizeof(int32_t)");
return reinterpret_cast<const int32_t&>(*this)
- reinterpret_cast<int32_t&>(other);
inline long compare(stream_slots other) const noexcept {
static_assert(sizeof(long) >= sizeof(int32_t),
"sizeof(long) < sizeof(int32_t)");
long x = (sender << 16) | receiver;
long y = (other.sender << 16) | other.receiver;
return x - y;
}
};
......
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