From 0df165c04d0a9ca1adde9ed2b890344c937954a6 Mon Sep 17 00:00:00 2001 From: ad Date: Wed, 28 Nov 2007 17:03:35 +0000 Subject: [PATCH] Use xchgb, bswapl and not rotate/shift. --- common/lib/libc/arch/i386/gen/byte_swap_2.S | 6 +++--- common/lib/libc/arch/i386/gen/byte_swap_4.S | 8 +++----- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/common/lib/libc/arch/i386/gen/byte_swap_2.S b/common/lib/libc/arch/i386/gen/byte_swap_2.S index dd21570f883f..5150f1761fe4 100644 --- a/common/lib/libc/arch/i386/gen/byte_swap_2.S +++ b/common/lib/libc/arch/i386/gen/byte_swap_2.S @@ -1,4 +1,4 @@ -/* $NetBSD: byte_swap_2.S,v 1.2 2005/12/27 09:38:11 yamt Exp $ */ +/* $NetBSD: byte_swap_2.S,v 1.3 2007/11/28 17:03:35 ad Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -36,7 +36,7 @@ #include #if defined(LIBC_SCCS) - RCSID("$NetBSD: byte_swap_2.S,v 1.2 2005/12/27 09:38:11 yamt Exp $") + RCSID("$NetBSD: byte_swap_2.S,v 1.3 2007/11/28 17:03:35 ad Exp $") #endif #if defined(_KERNEL) || defined(_STANDALONE) @@ -48,5 +48,5 @@ _ENTRY(_C_LABEL(ntohs)) _ENTRY(_C_LABEL(htons)) _PROF_PROLOGUE movzwl 4(%esp),%eax - rorw $8,%ax + xchgb %al, %ah ret diff --git a/common/lib/libc/arch/i386/gen/byte_swap_4.S b/common/lib/libc/arch/i386/gen/byte_swap_4.S index 76e1ec83ff0b..0c48ae91d396 100644 --- a/common/lib/libc/arch/i386/gen/byte_swap_4.S +++ b/common/lib/libc/arch/i386/gen/byte_swap_4.S @@ -1,4 +1,4 @@ -/* $NetBSD: byte_swap_4.S,v 1.2 2005/12/27 09:38:11 yamt Exp $ */ +/* $NetBSD: byte_swap_4.S,v 1.3 2007/11/28 17:03:35 ad Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -36,7 +36,7 @@ #include #if defined(LIBC_SCCS) - RCSID("$NetBSD: byte_swap_4.S,v 1.2 2005/12/27 09:38:11 yamt Exp $") + RCSID("$NetBSD: byte_swap_4.S,v 1.3 2007/11/28 17:03:35 ad Exp $") #endif #if defined(_KERNEL) || defined(_STANDALONE) @@ -48,7 +48,5 @@ _ENTRY(_C_LABEL(ntohl)) _ENTRY(_C_LABEL(htonl)) _PROF_PROLOGUE movl 4(%esp),%eax - rorw $8,%ax - roll $16,%eax - rorw $8,%ax + bswap %eax ret