diff options
author | dzwdz | 2023-12-25 18:36:02 +0100 |
---|---|---|
committer | dzwdz | 2023-12-25 18:36:02 +0100 |
commit | 4e1a6f1b3c543b9fbeb882a9e97551f7c58ca65a (patch) | |
tree | 8c2048c751db8b98e3033a61b6ad5bbd11a303a9 /src/libc/arpainet.c | |
parent | 64d4330810a37dd9c41a82ae6cc420850ca1e7da (diff) |
ports: curl :^)
had to do a lot of hacky stuff, but it's there.
worked on this on and off for a while now
Diffstat (limited to 'src/libc/arpainet.c')
-rw-r--r-- | src/libc/arpainet.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/libc/arpainet.c b/src/libc/arpainet.c new file mode 100644 index 0000000..125a855 --- /dev/null +++ b/src/libc/arpainet.c @@ -0,0 +1,20 @@ +#include <arpa/inet.h> + +uint32_t htonl(uint32_t n) { + return ((n & 0xFF000000) >> 24) + | ((n & 0x00FF0000) >> 8) + | ((n & 0x0000FF00) << 8) + | ((n & 0x000000FF) << 24); +} + +uint16_t htons(uint16_t n) { + return (n >> 8) | (n << 8); +} + +uint32_t ntohl(uint32_t n) { + return htonl(n); +} + +uint16_t ntohs(uint16_t n) { + return htons(n); +} |