summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/lib/htons.c
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2001-05-14 14:19:32 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2001-05-14 14:19:32 +0000
commit167217bec15c9c7aa70ba2a3dc9c689b3cd91872 (patch)
tree7c0c62debf8f9f145643102fb52b81afce743594 /mdk-stage1/dietlibc/lib/htons.c
parent9097327dc1c667fc51b8e05cc7c0626fac96665d (diff)
downloaddrakx-backup-do-not-use-167217bec15c9c7aa70ba2a3dc9c689b3cd91872.tar
drakx-backup-do-not-use-167217bec15c9c7aa70ba2a3dc9c689b3cd91872.tar.gz
drakx-backup-do-not-use-167217bec15c9c7aa70ba2a3dc9c689b3cd91872.tar.bz2
drakx-backup-do-not-use-167217bec15c9c7aa70ba2a3dc9c689b3cd91872.tar.xz
drakx-backup-do-not-use-167217bec15c9c7aa70ba2a3dc9c689b3cd91872.zip
import new version of dietlibc
Diffstat (limited to 'mdk-stage1/dietlibc/lib/htons.c')
-rw-r--r--mdk-stage1/dietlibc/lib/htons.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/mdk-stage1/dietlibc/lib/htons.c b/mdk-stage1/dietlibc/lib/htons.c
index 92a43f937..765d3bbc5 100644
--- a/mdk-stage1/dietlibc/lib/htons.c
+++ b/mdk-stage1/dietlibc/lib/htons.c
@@ -1,12 +1,11 @@
-#include <asm/byteorder.h>
+#include <endian.h>
-#undef htons
-#ifdef __i386__
-unsigned short int htons(unsigned short int netshort) {
- return ___arch__swab16(netshort);
-}
+unsigned short int htons(unsigned short int hostshort) {
+#if __BYTE_ORDER==__LITTLE_ENDIAN
+ return ((hostshort>>8)&0xff) | (hostshort<<8);
#else
-unsigned short int htons(unsigned short int netshort) {
- return netshort;
-}
+ return hostshort;
#endif
+}
+
+unsigned short int ntohs(unsigned short int hostshort) __attribute__((weak,alias("htons")));