[libc] Implement htonl and htons
authorRaman Tenneti <rtenneti@google.com>
Thu, 16 Feb 2023 17:56:36 +0000 (09:56 -0800)
committerRaman Tenneti <rtenneti@google.com>
Thu, 16 Feb 2023 18:12:18 +0000 (10:12 -0800)
commitfbe210dc7a6ad87a30e5ffe928a168e621f6fcc5
tree1f606f182924eebcb5d645c329d2a98285ff8d49
parent35742743d27363dd25c6b0bde3e9fcfd8a0f2167
[libc] Implement htonl and htons

Per spec:
* https://pubs.opengroup.org/onlinepubs/9699919799/functions/htonl.html
* https://pubs.opengroup.org/onlinepubs/9699919799/functions/htons.html

Also adds UInt16Type and UInt32Type to spec.td

Co-authored-by: Jeff Bailey <jbailey@google.com>
Reviewed By: sivachandra, jeffbailey, rtenneti

Differential Revision: https://reviews.llvm.org/D143795
17 files changed:
libc/config/linux/aarch64/entrypoints.txt
libc/config/linux/x86_64/entrypoints.txt
libc/config/linux/x86_64/headers.txt
libc/include/CMakeLists.txt
libc/include/arpa/inet.h.def [new file with mode: 0644]
libc/spec/posix.td
libc/spec/spec.td
libc/src/CMakeLists.txt
libc/src/network/CMakeLists.txt [new file with mode: 0644]
libc/src/network/htonl.cpp [new file with mode: 0644]
libc/src/network/htonl.h [new file with mode: 0644]
libc/src/network/htons.cpp [new file with mode: 0644]
libc/src/network/htons.h [new file with mode: 0644]
libc/test/src/CMakeLists.txt
libc/test/src/network/CMakeLists.txt [new file with mode: 0644]
libc/test/src/network/htonl_test.cpp [new file with mode: 0644]
libc/test/src/network/htons_test.cpp [new file with mode: 0644]