From 62f696fcfaaf07cf996963779e0bded74ee168b2 Mon Sep 17 00:00:00 2001 From: "David E. O'Brien" Date: Mon, 18 Oct 2004 17:19:36 +0000 Subject: [PATCH] Sync with sys/i386/include/endian.h: use the single instruction 'bswap'. --- lib/libc/i386/net/htonl.S | 4 ++++ lib/libc/i386/net/ntohl.S | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/lib/libc/i386/net/htonl.S b/lib/libc/i386/net/htonl.S index da74ed67a90..8c79bf63ba0 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 15e2d6e3523..c7fc6c3fef2 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