[libc-commits] [PATCH] D143795: [libc] Implement htonl and htons
Siva Chandra via Phabricator via libc-commits
libc-commits at lists.llvm.org
Wed Feb 15 13:59:06 PST 2023
sivachandra added inline comments.
================
Comment at: libc/include/arpa/inet.h.def:12
+
+#include <__llvm-libc-common.h>
+
----------------
I think you should include `inttypes.h` here.
================
Comment at: libc/src/network/htons.cpp:16
+LLVM_LIBC_FUNCTION(uint16_t, htons, (uint16_t hostlong)) {
+ return Endian::IS_LITTLE ? __builtin_bswap16(hostlong) : hostlong;
+}
----------------
Can we just do:
```
return Endian::to_big_endian(hostlong);
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143795/new/
https://reviews.llvm.org/D143795
More information about the libc-commits
mailing list