summaryrefslogtreecommitdiff
path: root/lib/libc/string
diff options
context:
space:
mode:
authorapb <apb@NetBSD.org>2010-04-18 11:39:39 +0000
committerapb <apb@NetBSD.org>2010-04-18 11:39:39 +0000
commit67ca6b24d256594e5e018d2cb217f643fa9b2782 (patch)
treef4eb9f8cc10515783a223795bdb7c8a222483fbb /lib/libc/string
parentfa3abaaeb777f47ac8fa2113510aad86bf6efd3c (diff)
The number of byte pairs to swap is len/2, not len/2+1.
Diffstat (limited to 'lib/libc/string')
-rw-r--r--lib/libc/string/swab.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libc/string/swab.c b/lib/libc/string/swab.c
index bb5b21f3ebe..0a9946d4f27 100644
--- a/lib/libc/string/swab.c
+++ b/lib/libc/string/swab.c
@@ -1,4 +1,4 @@
-/* $NetBSD: swab.c,v 1.16 2010/04/18 10:51:33 apb Exp $ */
+/* $NetBSD: swab.c,v 1.17 2010/04/18 11:39:39 apb Exp $ */
/*
* Copyright (c) 1988, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)swab.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: swab.c,v 1.16 2010/04/18 10:51:33 apb Exp $");
+__RCSID("$NetBSD: swab.c,v 1.17 2010/04/18 11:39:39 apb Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -57,7 +57,7 @@ swab(const void * __restrict from, void * __restrict to, ssize_t len)
_DIAGASSERT(from != NULL);
_DIAGASSERT(to != NULL);
- len = (len / 2) + 1;
+ len /= 2;
fp = (const char *)from;
tp = (char *)to;
#define STEP temp = *fp++,*tp++ = *fp++,*tp++ = temp