diff --git a/ircd/net.cc b/ircd/net.cc index 0792aa742..211904dfb 100644 --- a/ircd/net.cc +++ b/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(ip) + std::bit_cast(hton(ip)) }; - - auto punpun - { - reinterpret_cast &>(pun) - }; - - std::reverse(begin(punpun), end(punpun)); - return ip::address_v6{punpun}; } +#else +{ + return ip::address_v6 + { + reinterpret_cast(hton(ip)) + }; +} +#endif std::ostream & ircd::net::operator<<(std::ostream &s, const ipaddr &ipa)