summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-08-12 21:39:52 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-08-12 21:39:52 -0700
commit69269947f6f716dcb01f3bf00e9a4ca00c04c10c (patch)
tree6576fc96e70edfffc1a72e80d367f25499c7f104
parentff30d914fe20fd5e4743b906ecfe0239f1c4e013 (diff)
downloadsyslinux-69269947f6f716dcb01f3bf00e9a4ca00c04c10c.tar.gz
netinet/in.h: add __constfunc to inlines
All the byte-swapping functions are true constfuncs... Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--com32/include/netinet/in.h9
1 files changed, 5 insertions, 4 deletions
diff --git a/com32/include/netinet/in.h b/com32/include/netinet/in.h
index 9c5173be..ea0a1788 100644
--- a/com32/include/netinet/in.h
+++ b/com32/include/netinet/in.h
@@ -4,10 +4,11 @@
/* COM32 will be running on an i386 platform */
#include <stdint.h>
+#include <klibc/compiler.h>
#define __htons_macro(v) (((uint16_t)(v) << 8) | ((uint16_t)(v) >> 8))
-static inline uint16_t __htons(uint16_t v)
+static inline __constfunc uint16_t __htons(uint16_t v)
{
return __htons_macro(v);
}
@@ -20,12 +21,12 @@ static inline uint16_t __htons(uint16_t v)
(((uint32_t)(v) & 0x00ff0000) >> 8) | \
(((uint32_t)(v) & 0xff000000) >> 24))
-static inline uint32_t __htonl(uint32_t v)
+static inline __constfunc uint32_t __htonl(uint32_t v)
{
if (__builtin_constant_p(v)) {
return __htonl_macro(v);
} else {
- asm("xchgb %h0,%b0 ; roll $16,%0 ; xchgb %h0,%b0":"+q"(v));
+ asm("xchgb %h0,%b0 ; roll $16,%0 ; xchgb %h0,%b0" : "+q"(v));
return v;
}
}
@@ -37,7 +38,7 @@ static inline uint32_t __htonl(uint32_t v)
(((uint64_t)__htonl_macro((uint32_t)(v)) << 32) | \
(__htonl_macro((uint32_t)((uint64_t)(v) >> 32))))
-static inline uint64_t __htonq(uint64_t v)
+static inline __constfunc uint64_t __htonq(uint64_t v)
{
return ((uint64_t) __htonl(v) << 32) | __htonl(v >> 32);
}