summaryrefslogtreecommitdiff
path: root/com32/include/netinet
diff options
context:
space:
mode:
authorhpa <hpa>2005-01-20 22:44:13 +0000
committerhpa <hpa>2005-01-20 22:44:13 +0000
commitf7c564216b2d987a1b0b30602fd33536c7f4276e (patch)
tree448fe42d2433266bb75d74daad871adfe551bb81 /com32/include/netinet
parent46d256d6481ac0fc069968eadc816007a0a72427 (diff)
downloadsyslinux-f7c564216b2d987a1b0b30602fd33536c7f4276e.tar.gz
SHA-1 support in libutil; beginnings of menu passwd support
Diffstat (limited to 'com32/include/netinet')
-rw-r--r--com32/include/netinet/in.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/com32/include/netinet/in.h b/com32/include/netinet/in.h
new file mode 100644
index 00000000..dc11448b
--- /dev/null
+++ b/com32/include/netinet/in.h
@@ -0,0 +1,43 @@
+#ifndef _NETINET_IN_H
+#define _NETINET_IN_H
+
+/* COM32 will be running on an i386 platform */
+
+#include <stdint.h>
+
+static inline uint16_t __htons(uint16_t v)
+{
+ return ((v) << 8) | ((v) >> 8);
+}
+
+#define htons(x) __htons(x)
+#define ntohs(x) __htons(x)
+
+static inline uint32_t __htonl(uint32_t v)
+{
+ if ( __builtin_constant_p(v) ) {
+ return (((v) & 0x000000ff) << 24) |
+ (((v) & 0x0000ff00) << 8) |
+ (((v) & 0x00ff0000) >> 8) |
+ (((v) & 0xff000000) >> 24);
+ } else {
+ asm("xchgb %h0,%b0 ; roll $16,%0 ; xchgb %h0,%b0" : "+abcd" (v));
+ return v;
+ }
+}
+
+#define htonl(x) __htonl(x)
+#define ntohl(x) __ntohl(x)
+
+static inline uint64_t __htonq(uint64_t v)
+{
+ return ((uint64_t) __htonl(v) << 32) | __htonl(v >> 32);
+}
+
+#define htonq(x) __htonq(x)
+#define ntohq(x) __ntohq(x)
+
+#endif /* _NETINET_IN_H */
+
+
+