mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-18 09:04:23 -04:00
util: update some bit utility logic
This commit is contained in:
parent
d7f89a0c31
commit
442656899f
3 changed files with 102 additions and 130 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue