util: update some bit utility logic

This commit is contained in:
Michael Scire 2022-04-03 10:51:46 -07:00
parent d7f89a0c31
commit 442656899f
3 changed files with 102 additions and 130 deletions

View file

@ -113,35 +113,19 @@ namespace ams::socket::impl {
}
u32 InetHtonl(u32 host) {
if constexpr (util::IsBigEndian()) {
return host;
} else {
return util::SwapBytes(host);
}
return util::ConvertToBigEndian(host);
}
u16 InetHtons(u16 host) {
if constexpr (util::IsBigEndian()) {
return host;
} else {
return util::SwapBytes(host);
}
return util::ConvertToBigEndian(host);
}
u32 InetNtohl(u32 net) {
if constexpr (util::IsBigEndian()) {
return net;
} else {
return util::SwapBytes(net);
}
return util::ConvertFromBigEndian(net);
}
u16 InetNtohs(u16 net) {
if constexpr (util::IsBigEndian()) {
return net;
} else {
return util::SwapBytes(net);
}
return util::ConvertFromBigEndian(net);
}
namespace {