Use xchgb, bswapl and not rotate/shift.
This commit is contained in:
parent
bce4ea0296
commit
0df165c04d
|
@ -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 <machine/asm.h>
|
||||
#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
|
||||
|
|
|
@ -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 <machine/asm.h>
|
||||
#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
|
||||
|
|
Loading…
Reference in New Issue