diff --git a/libc/src/network/ntohl.cpp b/libc/src/network/ntohl.cpp --- a/libc/src/network/ntohl.cpp +++ b/libc/src/network/ntohl.cpp @@ -13,7 +13,10 @@ namespace __llvm_libc { LLVM_LIBC_FUNCTION(uint32_t, ntohl, (uint32_t netlong)) { - return Endian::IS_LITTLE ? __builtin_bswap32(netlong) : netlong; + if constexpr (Endian::IS_LITTLE) + return __builtin_bswap32(netlong); + else + return netlong; } } // namespace __llvm_libc diff --git a/libc/src/network/ntohs.cpp b/libc/src/network/ntohs.cpp --- a/libc/src/network/ntohs.cpp +++ b/libc/src/network/ntohs.cpp @@ -13,7 +13,10 @@ namespace __llvm_libc { LLVM_LIBC_FUNCTION(uint16_t, ntohs, (uint16_t netshort)) { - return Endian::IS_LITTLE ? __builtin_bswap16(netshort) : netshort; + if constexpr (Endian::IS_LITTLE) + return __builtin_bswap16(netshort); + else + return netshort; } } // namespace __llvm_libc