0
0
Fork 0
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:
Jason Volk 2022-07-01 12:04:21 -07:00
parent c60fc0ccdd
commit a013674beb

View file

@ -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)