This is an archive of the discontinued LLVM Phabricator instance.

[libc] Implement htonl and htons
ClosedPublic

Authored by rtenneti on Feb 10 2023, 4:39 PM.

Diff Detail

Event Timeline

rtenneti created this revision.Feb 10 2023, 4:39 PM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptFeb 10 2023, 4:39 PM
rtenneti requested review of this revision.Feb 10 2023, 4:39 PM
sivachandra added inline comments.Feb 15 2023, 1:59 PM
libc/include/arpa/inet.h.def
13

I think you should include inttypes.h here.

libc/src/network/htons.cpp
17

Can we just do:

return Endian::to_big_endian(hostlong);
rtenneti updated this revision to Diff 497859.Feb 15 2023, 6:28 PM
rtenneti marked an inline comment as done.

Fixed comments from Siva.

rtenneti marked an inline comment as done.Feb 15 2023, 6:30 PM
rtenneti added a reviewer: jeffbailey.
jeffbailey accepted this revision.Feb 15 2023, 7:08 PM
This revision is now accepted and ready to land.Feb 15 2023, 7:08 PM
sivachandra accepted this revision.Feb 15 2023, 7:47 PM
sivachandra added inline comments.
libc/src/network/htons.cpp
16

hostshort?

rtenneti updated this revision to Diff 498052.Feb 16 2023, 9:30 AM

In htons changed variable name from hostlong to hostshort.

rtenneti accepted this revision.Feb 16 2023, 9:30 AM
rtenneti marked an inline comment as done.
This revision was automatically updated to reflect the committed changes.