Per spec:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/ntohl.html
https://pubs.opengroup.org/onlinepubs/9699919799/functions/ntohs.html
Co-authored-by: Jeff Bailey <jbailey@google.com>
Paths
| Differential D144506
[libc] Implement ntohl and ntohs ClosedPublic Authored by rtenneti on Feb 21 2023, 9:59 AM.
Details
Summary Per spec: https://pubs.opengroup.org/onlinepubs/9699919799/functions/ntohl.html Co-authored-by: Jeff Bailey <jbailey@google.com>
Diff Detail
Event TimelineHerald added projects: Restricted Project, Restricted Project. · View Herald TranscriptFeb 21 2023, 9:59 AM sivachandra added inline comments.
Comment Actions + Added explicit check for IS_LITTLE to do the swap. Comment Actions Hi Siva, Added a htonl(ntohl(...)) test. Did the swap based on host's endianess. PTAL. sivachandra added inline comments.
This revision is now accepted and ready to land.Feb 21 2023, 10:02 PM Comment Actions Not sure what happened here, but the diff is not related to the topic of this change. Herald added projects: Restricted Project, Restricted Project, Restricted Project, Restricted Project. · View Herald TranscriptFeb 22 2023, 10:02 AM This revision now requires review to proceed.Feb 22 2023, 10:02 AM philnik removed reviewers: Restricted Project, Restricted Project, Restricted Project.Feb 22 2023, 10:15 AM This revision is now accepted and ready to land.Feb 22 2023, 10:15 AM This revision was landed with ongoing or failed builds.Feb 22 2023, 10:40 AM Closed by commit rGd0d6d78bbda7: [libc] Implement ntohl and ntohs (authored by rtenneti). · Explain Why This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 499581 libc/config/linux/aarch64/entrypoints.txt
libc/config/linux/x86_64/entrypoints.txt
libc/spec/posix.td
libc/src/network/CMakeLists.txt
libc/src/network/htons.h
libc/src/network/ntohl.h
libc/src/network/ntohl.cpp
libc/src/network/ntohs.h
libc/src/network/ntohs.cpp
libc/test/src/network/CMakeLists.txt
libc/test/src/network/htonl_test.cpp
libc/test/src/network/htons_test.cpp
libc/test/src/network/ntohl_test.cpp
libc/test/src/network/ntohs_test.cpp
|
Should this always convert to big-endian, or should it convert to the host's endianness?