mirror of
https://github.com/matrix-construct/construct
synced 2024-11-25 08:12:37 +01:00
ircd::net: Fix undefined reinterpret pun.
This commit is contained in:
parent
c60fc0ccdd
commit
a013674beb
1 changed files with 11 additions and 10 deletions
21
ircd/net.cc
21
ircd/net.cc
|
@ -2805,20 +2805,21 @@ ircd::net::make_address(const uint32_t &ip)
|
|||
[[gnu::visibility("protected")]]
|
||||
boost::asio::ip::address_v6
|
||||
ircd::net::make_address(const uint128_t &ip)
|
||||
#ifdef __cpp_lib_bit_cast
|
||||
{
|
||||
const auto &pun
|
||||
return ip::address_v6
|
||||
{
|
||||
reinterpret_cast<const uint8_t (&)[16]>(ip)
|
||||
std::bit_cast<decltype(ipaddr::byte)>(hton(ip))
|
||||
};
|
||||
|
||||
auto punpun
|
||||
{
|
||||
reinterpret_cast<const std::array<uint8_t, 16> &>(pun)
|
||||
};
|
||||
|
||||
std::reverse(begin(punpun), end(punpun));
|
||||
return ip::address_v6{punpun};
|
||||
}
|
||||
#else
|
||||
{
|
||||
return ip::address_v6
|
||||
{
|
||||
reinterpret_cast<const decltype(ipaddr::byte) &&>(hton(ip))
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
||||
std::ostream &
|
||||
ircd::net::operator<<(std::ostream &s, const ipaddr &ipa)
|
||||
|
|
Loading…
Reference in a new issue