summaryrefslogtreecommitdiff
path: root/lib/libc/string
diff options
context:
space:
mode:
authorapb <apb@NetBSD.org>2010-04-18 10:51:33 +0000
committerapb <apb@NetBSD.org>2010-04-18 10:51:33 +0000
commitfa3abaaeb777f47ac8fa2113510aad86bf6efd3c (patch)
treec0ad7d929eb57861d7baefb122a0ad869235e9f5 /lib/libc/string
parent0b7093053e62f42a2f2125da6655da38a3406d0b (diff)
Bitwise operations on signed types are well-defined if the values
happen to be positive, and indeed the values here were guaranteed to be positive, but some compilers complained anyway, so convert the bitwise operations to arithmetic operations.
Diffstat (limited to 'lib/libc/string')
-rw-r--r--lib/libc/string/swab.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libc/string/swab.c b/lib/libc/string/swab.c
index 83c85cb8ba3..bb5b21f3ebe 100644
--- a/lib/libc/string/swab.c
+++ b/lib/libc/string/swab.c
@@ -1,4 +1,4 @@
-/* $NetBSD: swab.c,v 1.15 2010/04/18 04:54:33 christos Exp $ */
+/* $NetBSD: swab.c,v 1.16 2010/04/18 10:51:33 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.15 2010/04/18 04:54:33 christos Exp $");
+__RCSID("$NetBSD: swab.c,v 1.16 2010/04/18 10:51:33 apb Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -62,9 +62,9 @@ swab(const void * __restrict from, void * __restrict to, ssize_t len)
tp = (char *)to;
#define STEP temp = *fp++,*tp++ = *fp++,*tp++ = temp
/* round to multiple of 8 */
- while ((--len & 07) != 0)
+ while ((--len % 8) != 0)
STEP;
- len >>= 3;
+ len /= 8;
if (len == 0)
return;
while (len-- != 0) {