summaryrefslogtreecommitdiff
path: root/lib/libc/string/swab.c
diff options
context:
space:
mode:
authorRobert Drehmel <robert@FreeBSD.org>2002-08-30 20:33:05 +0000
committerRobert Drehmel <robert@FreeBSD.org>2002-08-30 20:33:05 +0000
commitc9ab23eea5c76552818f1d85374bcdf94d678982 (patch)
treebbcfbe7e8b5519fd93596d68c5a090a398784294 /lib/libc/string/swab.c
parent8e52da4dfcd3adc90148ef8cd0e05c8b32cf9e15 (diff)
Notes
Diffstat (limited to 'lib/libc/string/swab.c')
-rw-r--r--lib/libc/string/swab.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/libc/string/swab.c b/lib/libc/string/swab.c
index 70da36f2c057..aa6f2682c01b 100644
--- a/lib/libc/string/swab.c
+++ b/lib/libc/string/swab.c
@@ -43,24 +43,20 @@ __FBSDID("$FreeBSD$");
#include <string.h>
void
-swab(from, to, len)
- const void *from;
- void *to;
- size_t len;
+swab(const void * __restrict from, void * __restrict to, size_t len)
{
unsigned long temp;
int n;
char *fp, *tp;
- n = (len >> 1) + 1;
+ n = len >> 1;
fp = (char *)from;
tp = (char *)to;
#define STEP temp = *fp++,*tp++ = *fp++,*tp++ = temp
/* round to multiple of 8 */
- while ((--n) & 07)
+ for (; n & 0x7; --n)
STEP;
- n >>= 3;
- while (--n >= 0) {
+ for (n >>= 3; n > 0; --n) {
STEP; STEP; STEP; STEP;
STEP; STEP; STEP; STEP;
}