summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2004-10-18 17:19:36 +0000
committerobrien <obrien@FreeBSD.org>2004-10-18 17:19:36 +0000
commit01b92944618ba6e2ed942c1aa01078f061ba30dd (patch)
treeebcc3870843922b8f9b4ee1fe5a07a4749e20c1e /lib
parentbf96115d5c1c15c8b296f23b175b6ae1a6c0a7f6 (diff)
downloadFreeBSD-src-01b92944618ba6e2ed942c1aa01078f061ba30dd.zip
FreeBSD-src-01b92944618ba6e2ed942c1aa01078f061ba30dd.tar.gz
Sync with sys/i386/include/endian.h: use the single instruction 'bswap'.
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/i386/net/htonl.S4
-rw-r--r--lib/libc/i386/net/ntohl.S4
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/libc/i386/net/htonl.S b/lib/libc/i386/net/htonl.S
index da74ed6..8c79bf6 100644
--- a/lib/libc/i386/net/htonl.S
+++ b/lib/libc/i386/net/htonl.S
@@ -46,7 +46,11 @@ __FBSDID("$FreeBSD$");
.set CNAME(htonl),CNAME(__htonl)
ENTRY(__htonl)
movl 4(%esp),%eax
+#ifdef I386_CPU
xchgb %al,%ah
roll $16,%eax
xchgb %al,%ah
+#else
+ bswap %eax
+#endif
ret
diff --git a/lib/libc/i386/net/ntohl.S b/lib/libc/i386/net/ntohl.S
index 15e2d6e..c7fc6c3 100644
--- a/lib/libc/i386/net/ntohl.S
+++ b/lib/libc/i386/net/ntohl.S
@@ -46,7 +46,11 @@ __FBSDID("$FreeBSD$");
.set CNAME(ntohl),CNAME(__ntohl)
ENTRY(__ntohl)
movl 4(%esp),%eax
+#ifdef I386_CPU
xchgb %al,%ah
roll $16,%eax
xchgb %al,%ah
+#else
+ bswap %eax
+#endif
ret
OpenPOWER on IntegriCloud