summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/lib/libkern/adddi3.c11
-rw-r--r--sys/lib/libkern/anddi3.c9
-rw-r--r--sys/lib/libkern/ashldi3.c20
-rw-r--r--sys/lib/libkern/ashrdi3.c29
-rw-r--r--sys/lib/libkern/bcmp.c19
-rw-r--r--sys/lib/libkern/bzero.c5
-rw-r--r--sys/lib/libkern/cmpdi2.c9
-rw-r--r--sys/lib/libkern/divdi3.c27
-rw-r--r--sys/lib/libkern/ffs.c4
-rw-r--r--sys/lib/libkern/htonl.c16
-rw-r--r--sys/lib/libkern/htons.c7
-rw-r--r--sys/lib/libkern/iordi3.c9
-rw-r--r--sys/lib/libkern/lshldi3.c20
-rw-r--r--sys/lib/libkern/lshrdi3.c20
-rw-r--r--sys/lib/libkern/moddi3.c29
-rw-r--r--sys/lib/libkern/muldi3.c48
-rw-r--r--sys/lib/libkern/negdi2.c9
-rw-r--r--sys/lib/libkern/notdi2.c9
-rw-r--r--sys/lib/libkern/ntohl.c16
-rw-r--r--sys/lib/libkern/ntohs.c7
-rw-r--r--sys/lib/libkern/qdivrem.c73
-rw-r--r--sys/lib/libkern/quad.h81
-rw-r--r--sys/lib/libkern/strcat.c16
-rw-r--r--sys/lib/libkern/strcmp.c9
-rw-r--r--sys/lib/libkern/strcpy.c10
-rw-r--r--sys/lib/libkern/strlen.c4
-rw-r--r--sys/lib/libkern/strncmp.c8
-rw-r--r--sys/lib/libkern/strncpy.c5
-rw-r--r--sys/lib/libkern/subdi3.c11
-rw-r--r--sys/lib/libkern/ucmpdi2.c9
-rw-r--r--sys/lib/libkern/udivdi3.c9
-rw-r--r--sys/lib/libkern/umoddi3.c9
-rw-r--r--sys/lib/libkern/xordi3.c9
33 files changed, 217 insertions, 359 deletions
diff --git a/sys/lib/libkern/adddi3.c b/sys/lib/libkern/adddi3.c
index f607fa53621..8bf39bced9e 100644
--- a/sys/lib/libkern/adddi3.c
+++ b/sys/lib/libkern/adddi3.c
@@ -1,6 +1,3 @@
-/* $OpenBSD: adddi3.c,v 1.4 2004/08/07 00:38:32 deraadt Exp $ */
-/* $NetBSD: adddi3.c,v 1.5 1995/10/07 09:26:14 mycroft Exp $ */
-
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -35,18 +32,14 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)adddi3.c 8.1 (Berkeley) 6/4/93";
-#else
-static char rcsid[] = "$OpenBSD: adddi3.c,v 1.4 2004/08/07 00:38:32 deraadt Exp $";
-#endif
+static char rcsid[] = "$OpenBSD: adddi3.c,v 1.5 2004/11/28 07:23:41 mickey Exp $";
#endif /* LIBC_SCCS and not lint */
#include "quad.h"
/*
* Add two quads. This is trivial since a one-bit carry from a single
- * u_long addition x+y occurs if and only if the sum x+y is less than
+ * u_int addition x+y occurs if and only if the sum x+y is less than
* either x or y (the choice to compare with x or y is arbitrary).
*/
quad_t
diff --git a/sys/lib/libkern/anddi3.c b/sys/lib/libkern/anddi3.c
index b27e2cda89e..dfd7c0b81bc 100644
--- a/sys/lib/libkern/anddi3.c
+++ b/sys/lib/libkern/anddi3.c
@@ -1,6 +1,3 @@
-/* $OpenBSD: anddi3.c,v 1.4 2004/08/07 00:38:32 deraadt Exp $ */
-/* $NetBSD: anddi3.c,v 1.5 1995/10/07 09:26:15 mycroft Exp $ */
-
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -35,11 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)anddi3.c 8.1 (Berkeley) 6/4/93";
-#else
-static char rcsid[] = "$OpenBSD: anddi3.c,v 1.4 2004/08/07 00:38:32 deraadt Exp $";
-#endif
+static char rcsid[] = "$OpenBSD: anddi3.c,v 1.5 2004/11/28 07:23:41 mickey Exp $";
#endif /* LIBC_SCCS and not lint */
#include "quad.h"
diff --git a/sys/lib/libkern/ashldi3.c b/sys/lib/libkern/ashldi3.c
index d767a377321..e2dab04b2be 100644
--- a/sys/lib/libkern/ashldi3.c
+++ b/sys/lib/libkern/ashldi3.c
@@ -1,6 +1,3 @@
-/* $OpenBSD: ashldi3.c,v 1.4 2004/08/07 00:38:32 deraadt Exp $ */
-/* $NetBSD: ashldi3.c,v 1.5 1995/10/07 09:26:17 mycroft Exp $ */
-
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -35,11 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)ashldi3.c 8.1 (Berkeley) 6/4/93";
-#else
-static char rcsid[] = "$OpenBSD: ashldi3.c,v 1.4 2004/08/07 00:38:32 deraadt Exp $";
-#endif
+static char rcsid[] = "$OpenBSD: ashldi3.c,v 1.5 2004/11/28 07:23:41 mickey Exp $";
#endif /* LIBC_SCCS and not lint */
#include "quad.h"
@@ -53,14 +46,15 @@ __ashldi3(quad_t a, qshift_t shift)
{
union uu aa;
+ if (shift == 0)
+ return(a);
aa.q = a;
- if (shift >= LONG_BITS) {
- aa.ul[H] = shift >= QUAD_BITS ? 0 :
- aa.ul[L] << (shift - LONG_BITS);
+ if (shift >= INT_BITS) {
+ aa.ul[H] = aa.ul[L] << (shift - INT_BITS);
aa.ul[L] = 0;
- } else if (shift > 0) {
+ } else {
aa.ul[H] = (aa.ul[H] << shift) |
- (aa.ul[L] >> (LONG_BITS - shift));
+ (aa.ul[L] >> (INT_BITS - shift));
aa.ul[L] <<= shift;
}
return (aa.q);
diff --git a/sys/lib/libkern/ashrdi3.c b/sys/lib/libkern/ashrdi3.c
index b00d6174bab..dd265216c6b 100644
--- a/sys/lib/libkern/ashrdi3.c
+++ b/sys/lib/libkern/ashrdi3.c
@@ -1,6 +1,3 @@
-/* $OpenBSD: ashrdi3.c,v 1.4 2004/08/07 00:38:32 deraadt Exp $ */
-/* $NetBSD: ashrdi3.c,v 1.5 1995/10/07 09:26:18 mycroft Exp $ */
-
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -35,11 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)ashrdi3.c 8.1 (Berkeley) 6/4/93";
-#else
-static char rcsid[] = "$OpenBSD: ashrdi3.c,v 1.4 2004/08/07 00:38:32 deraadt Exp $";
-#endif
+static char rcsid[] = "$OpenBSD: ashrdi3.c,v 1.5 2004/11/28 07:23:41 mickey Exp $";
#endif /* LIBC_SCCS and not lint */
#include "quad.h"
@@ -52,24 +45,28 @@ __ashrdi3(quad_t a, qshift_t shift)
{
union uu aa;
+ if (shift == 0)
+ return(a);
aa.q = a;
- if (shift >= LONG_BITS) {
- long s;
+ if (shift >= INT_BITS) {
+ int s;
/*
* Smear bits rightward using the machine's right-shift
* method, whether that is sign extension or zero fill,
* to get the `sign word' s. Note that shifting by
- * LONG_BITS is undefined, so we shift (LONG_BITS-1),
+ * INT_BITS is undefined, so we shift (INT_BITS-1),
* then 1 more, to get our answer.
*/
- s = (aa.sl[H] >> (LONG_BITS - 1)) >> 1;
- aa.ul[L] = shift >= QUAD_BITS ? s :
- aa.sl[H] >> (shift - LONG_BITS);
+ /* LINTED inherits machine dependency */
+ s = (aa.sl[H] >> (INT_BITS - 1)) >> 1;
+ /* LINTED inherits machine dependency*/
+ aa.ul[L] = aa.sl[H] >> (shift - INT_BITS);
aa.ul[H] = s;
- } else if (shift > 0) {
+ } else {
aa.ul[L] = (aa.ul[L] >> shift) |
- (aa.ul[H] << (LONG_BITS - shift));
+ (aa.ul[H] << (INT_BITS - shift));
+ /* LINTED inherits machine dependency */
aa.sl[H] >>= shift;
}
return (aa.q);
diff --git a/sys/lib/libkern/bcmp.c b/sys/lib/libkern/bcmp.c
index 21092ef1089..8096e9959f8 100644
--- a/sys/lib/libkern/bcmp.c
+++ b/sys/lib/libkern/bcmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bcmp.c,v 1.7 2004/08/07 00:38:32 deraadt Exp $ */
+/* $OpenBSD: bcmp.c,v 1.8 2004/11/28 07:23:41 mickey Exp $ */
/*
* Copyright (c) 1987 Regents of the University of California.
@@ -30,8 +30,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-/*static char *sccsid = "from: @(#)bcmp.c 5.6 (Berkeley) 2/24/91";*/
-static char *rcsid = "$OpenBSD: bcmp.c,v 1.7 2004/08/07 00:38:32 deraadt Exp $";
+static char *rcsid = "$OpenBSD: bcmp.c,v 1.8 2004/11/28 07:23:41 mickey Exp $";
#endif /* LIBC_SCCS and not lint */
#if !defined(_KERNEL) && !defined(_STANDALONE)
@@ -44,19 +43,19 @@ static char *rcsid = "$OpenBSD: bcmp.c,v 1.7 2004/08/07 00:38:32 deraadt Exp $";
* bcmp -- vax cmpc3 instruction
*/
int
-bcmp(const void *b1, const void *b2, size_t length)
+bcmp(b1, b2, length)
+ const void *b1, *b2;
+ register size_t length;
{
- const char *p1, *p2;
+ register char *p1, *p2;
if (length == 0)
return(0);
-
- p1 = (const char *)b1;
- p2 = (const char *)b2;
+ p1 = (char *)b1;
+ p2 = (char *)b2;
do
if (*p1++ != *p2++)
break;
- while (--length)
- ;
+ while (--length);
return(length);
}
diff --git a/sys/lib/libkern/bzero.c b/sys/lib/libkern/bzero.c
index 9b432419ba5..6cbdba7785a 100644
--- a/sys/lib/libkern/bzero.c
+++ b/sys/lib/libkern/bzero.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bzero.c,v 1.6 2004/09/23 12:55:10 pefo Exp $ */
+/* $OpenBSD: bzero.c,v 1.7 2004/11/28 07:23:41 mickey Exp $ */
/*
* Copyright (c) 1987 Regents of the University of California.
@@ -30,8 +30,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-/*static char *sccsid = "from: @(#)bzero.c 5.7 (Berkeley) 2/24/91";*/
-static char *rcsid = "$OpenBSD: bzero.c,v 1.6 2004/09/23 12:55:10 pefo Exp $";
+static char *rcsid = "$OpenBSD: bzero.c,v 1.7 2004/11/28 07:23:41 mickey Exp $";
#endif /* LIBC_SCCS and not lint */
#if !defined(_KERNEL) && !defined(_STANDALONE)
diff --git a/sys/lib/libkern/cmpdi2.c b/sys/lib/libkern/cmpdi2.c
index ac17eb2a6a2..c44e3276465 100644
--- a/sys/lib/libkern/cmpdi2.c
+++ b/sys/lib/libkern/cmpdi2.c
@@ -1,6 +1,3 @@
-/* $OpenBSD: cmpdi2.c,v 1.4 2004/08/07 00:38:32 deraadt Exp $ */
-/* $NetBSD: cmpdi2.c,v 1.5 1995/10/07 09:26:22 mycroft Exp $ */
-
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -35,11 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)cmpdi2.c 8.1 (Berkeley) 6/4/93";
-#else
-static char rcsid[] = "$OpenBSD: cmpdi2.c,v 1.4 2004/08/07 00:38:32 deraadt Exp $";
-#endif
+static char rcsid[] = "$OpenBSD: cmpdi2.c,v 1.5 2004/11/28 07:23:41 mickey Exp $";
#endif /* LIBC_SCCS and not lint */
#include "quad.h"
diff --git a/sys/lib/libkern/divdi3.c b/sys/lib/libkern/divdi3.c
index 70008be0fa1..c77959ed469 100644
--- a/sys/lib/libkern/divdi3.c
+++ b/sys/lib/libkern/divdi3.c
@@ -1,6 +1,3 @@
-/* $OpenBSD: divdi3.c,v 1.4 2004/08/07 00:38:32 deraadt Exp $ */
-/* $NetBSD: divdi3.c,v 1.5 1995/10/07 09:26:24 mycroft Exp $ */
-
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -35,11 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)divdi3.c 8.1 (Berkeley) 6/4/93";
-#else
-static char rcsid[] = "$OpenBSD: divdi3.c,v 1.4 2004/08/07 00:38:32 deraadt Exp $";
-#endif
+static char rcsid[] = "$OpenBSD: divdi3.c,v 1.5 2004/11/28 07:23:41 mickey Exp $";
#endif /* LIBC_SCCS and not lint */
#include "quad.h"
@@ -52,16 +45,18 @@ quad_t
__divdi3(quad_t a, quad_t b)
{
u_quad_t ua, ub, uq;
- int neg;
+ int neg = 0;
+
+ ua = a;
+ ub = b;
if (a < 0)
- ua = -(u_quad_t)a, neg = 1;
- else
- ua = a, neg = 0;
+ ua = -ua, neg ^= 1;
if (b < 0)
- ub = -(u_quad_t)b, neg ^= 1;
- else
- ub = b;
+ ub = -ub, neg ^= 1;
+
uq = __qdivrem(ua, ub, (u_quad_t *)0);
- return (neg ? -uq : uq);
+ if (neg)
+ uq = - uq;
+ return uq;
}
diff --git a/sys/lib/libkern/ffs.c b/sys/lib/libkern/ffs.c
index a80bceedb09..0e64ffe6682 100644
--- a/sys/lib/libkern/ffs.c
+++ b/sys/lib/libkern/ffs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs.c,v 1.6 2004/08/07 00:38:32 deraadt Exp $ */
+/* $OpenBSD: ffs.c,v 1.7 2004/11/28 07:23:41 mickey Exp $ */
/*
* Public domain.
@@ -6,7 +6,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: ffs.c,v 1.6 2004/08/07 00:38:32 deraadt Exp $";
+static char *rcsid = "$OpenBSD: ffs.c,v 1.7 2004/11/28 07:23:41 mickey Exp $";
#endif /* LIBC_SCCS and not lint */
#if !defined(_KERNEL) && !defined(_STANDALONE)
diff --git a/sys/lib/libkern/htonl.c b/sys/lib/libkern/htonl.c
index 38faf1309f5..ad1b47b98d2 100644
--- a/sys/lib/libkern/htonl.c
+++ b/sys/lib/libkern/htonl.c
@@ -1,14 +1,11 @@
-/* $OpenBSD: htonl.c,v 1.4 2004/08/07 00:38:32 deraadt Exp $ */
-/* $NetBSD: htonl.c,v 1.6.6.1 1996/05/29 23:47:55 cgd Exp $ */
-
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$NetBSD: htonl.c,v 1.6.6.1 1996/05/29 23:47:55 cgd Exp $";
-#endif
+static char *rcsid = "$OpenBSD: htonl.c,v 1.5 2004/11/28 07:23:41 mickey Exp $";
+#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
#include <machine/endian.h>
@@ -16,14 +13,13 @@ static char *rcsid = "$NetBSD: htonl.c,v 1.6.6.1 1996/05/29 23:47:55 cgd Exp $";
#undef htonl
u_int32_t
-htonl(u_int32_t x)
+htonl(x)
+ u_int32_t x;
{
- u_int32_t y = x;
-
#if BYTE_ORDER == LITTLE_ENDIAN
- u_char *s = (u_char *)&y;
+ u_char *s = (u_char *)&x;
return (u_int32_t)(s[0] << 24 | s[1] << 16 | s[2] << 8 | s[3]);
#else
- return y;
+ return x;
#endif
}
diff --git a/sys/lib/libkern/htons.c b/sys/lib/libkern/htons.c
index 916ecc685bc..9a8d4053cf7 100644
--- a/sys/lib/libkern/htons.c
+++ b/sys/lib/libkern/htons.c
@@ -1,14 +1,11 @@
-/* $OpenBSD: htons.c,v 1.4 2004/08/07 00:38:32 deraadt Exp $ */
-/* $NetBSD: htons.c,v 1.6.6.1 1996/05/29 23:48:02 cgd Exp $ */
-
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$NetBSD: htons.c,v 1.6.6.1 1996/05/29 23:48:02 cgd Exp $";
-#endif
+static char *rcsid = "$OpenBSD: htons.c,v 1.5 2004/11/28 07:23:41 mickey Exp $";
+#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
#include <machine/endian.h>
diff --git a/sys/lib/libkern/iordi3.c b/sys/lib/libkern/iordi3.c
index 0509824bc04..c8adf1e4b5f 100644
--- a/sys/lib/libkern/iordi3.c
+++ b/sys/lib/libkern/iordi3.c
@@ -1,6 +1,3 @@
-/* $OpenBSD: iordi3.c,v 1.4 2004/08/07 00:38:32 deraadt Exp $ */
-/* $NetBSD: iordi3.c,v 1.5 1995/10/07 09:26:28 mycroft Exp $ */
-
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -35,11 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)iordi3.c 8.1 (Berkeley) 6/4/93";
-#else
-static char rcsid[] = "$OpenBSD: iordi3.c,v 1.4 2004/08/07 00:38:32 deraadt Exp $";
-#endif
+static char rcsid[] = "$OpenBSD: iordi3.c,v 1.5 2004/11/28 07:23:41 mickey Exp $";
#endif /* LIBC_SCCS and not lint */
#include "quad.h"
diff --git a/sys/lib/libkern/lshldi3.c b/sys/lib/libkern/lshldi3.c
index 0b793aebfe4..9d879bac8d9 100644
--- a/sys/lib/libkern/lshldi3.c
+++ b/sys/lib/libkern/lshldi3.c
@@ -1,6 +1,3 @@
-/* $OpenBSD: lshldi3.c,v 1.4 2004/08/07 00:38:32 deraadt Exp $ */
-/* $NetBSD: lshldi3.c,v 1.5 1995/10/07 09:26:29 mycroft Exp $ */
-
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -35,11 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)lshldi3.c 8.1 (Berkeley) 6/4/93";
-#else
-static char rcsid[] = "$OpenBSD: lshldi3.c,v 1.4 2004/08/07 00:38:32 deraadt Exp $";
-#endif
+static char rcsid[] = "$OpenBSD: lshldi3.c,v 1.5 2004/11/28 07:23:41 mickey Exp $";
#endif /* LIBC_SCCS and not lint */
#include "quad.h"
@@ -53,14 +46,15 @@ __lshldi3(quad_t a, qshift_t shift)
{
union uu aa;
+ if (shift == 0)
+ return(a);
aa.q = a;
- if (shift >= LONG_BITS) {
- aa.ul[H] = shift >= QUAD_BITS ? 0 :
- aa.ul[L] << (shift - LONG_BITS);
+ if (shift >= INT_BITS) {
+ aa.ul[H] = aa.ul[L] << (shift - INT_BITS);
aa.ul[L] = 0;
- } else if (shift > 0) {
+ } else {
aa.ul[H] = (aa.ul[H] << shift) |
- (aa.ul[L] >> (LONG_BITS - shift));
+ (aa.ul[L] >> (INT_BITS - shift));
aa.ul[L] <<= shift;
}
return (aa.q);
diff --git a/sys/lib/libkern/lshrdi3.c b/sys/lib/libkern/lshrdi3.c
index 5fafc064967..651e030f2bf 100644
--- a/sys/lib/libkern/lshrdi3.c
+++ b/sys/lib/libkern/lshrdi3.c
@@ -1,6 +1,3 @@
-/* $OpenBSD: lshrdi3.c,v 1.4 2004/08/07 00:38:32 deraadt Exp $ */
-/* $NetBSD: lshrdi3.c,v 1.5 1995/10/07 09:26:30 mycroft Exp $ */
-
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -35,11 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)lshrdi3.c 8.1 (Berkeley) 6/4/93";
-#else
-static char rcsid[] = "$OpenBSD: lshrdi3.c,v 1.4 2004/08/07 00:38:32 deraadt Exp $";
-#endif
+static char rcsid[] = "$OpenBSD: lshrdi3.c,v 1.5 2004/11/28 07:23:41 mickey Exp $";
#endif /* LIBC_SCCS and not lint */
#include "quad.h"
@@ -52,14 +45,15 @@ __lshrdi3(quad_t a, qshift_t shift)
{
union uu aa;
+ if (shift == 0)
+ return(a);
aa.q = a;
- if (shift >= LONG_BITS) {
- aa.ul[L] = shift >= QUAD_BITS ? 0 :
- aa.ul[H] >> (shift - LONG_BITS);
+ if (shift >= INT_BITS) {
+ aa.ul[L] = aa.ul[H] >> (shift - INT_BITS);
aa.ul[H] = 0;
- } else if (shift > 0) {
+ } else {
aa.ul[L] = (aa.ul[L] >> shift) |
- (aa.ul[H] << (LONG_BITS - shift));
+ (aa.ul[H] << (INT_BITS - shift));
aa.ul[H] >>= shift;
}
return (aa.q);
diff --git a/sys/lib/libkern/moddi3.c b/sys/lib/libkern/moddi3.c
index 948215fef41..88f5ab39001 100644
--- a/sys/lib/libkern/moddi3.c
+++ b/sys/lib/libkern/moddi3.c
@@ -1,6 +1,3 @@
-/* $OpenBSD: moddi3.c,v 1.4 2004/08/07 00:38:32 deraadt Exp $ */
-/* $NetBSD: moddi3.c,v 1.5 1995/10/07 09:26:31 mycroft Exp $ */
-
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -35,11 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)moddi3.c 8.1 (Berkeley) 6/4/93";
-#else
-static char rcsid[] = "$OpenBSD: moddi3.c,v 1.4 2004/08/07 00:38:32 deraadt Exp $";
-#endif
+static char rcsid[] = "$OpenBSD: moddi3.c,v 1.5 2004/11/28 07:23:41 mickey Exp $";
#endif /* LIBC_SCCS and not lint */
#include "quad.h"
@@ -47,23 +40,23 @@ static char rcsid[] = "$OpenBSD: moddi3.c,v 1.4 2004/08/07 00:38:32 deraadt Exp
/*
* Return remainder after dividing two signed quads.
*
- * XXX
- * If -1/2 should produce -1 on this machine, this code is wrong.
+ * XXX we assume a % b < 0 iff a < 0, but this is actually machine-dependent.
*/
quad_t
__moddi3(quad_t a, quad_t b)
{
u_quad_t ua, ub, ur;
- int neg;
+ int neg = 0;
+
+ ua = a;
+ ub = b;
if (a < 0)
- ua = -(u_quad_t)a, neg = 1;
- else
- ua = a, neg = 0;
+ ua = -ua, neg ^= 1;
if (b < 0)
- ub = -(u_quad_t)b, neg ^= 1;
- else
- ub = b;
+ ub = -ub;
(void)__qdivrem(ua, ub, &ur);
- return (neg ? -ur : ur);
+ if (neg)
+ ur = -ur;
+ return (ur);
}
diff --git a/sys/lib/libkern/muldi3.c b/sys/lib/libkern/muldi3.c
index 7fafbc10da5..48f5e303cb2 100644
--- a/sys/lib/libkern/muldi3.c
+++ b/sys/lib/libkern/muldi3.c
@@ -1,6 +1,3 @@
-/* $OpenBSD: muldi3.c,v 1.6 2004/08/07 00:38:32 deraadt Exp $ */
-/* $NetBSD: muldi3.c,v 1.5 1995/10/07 09:26:33 mycroft Exp $ */
-
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -35,11 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)muldi3.c 8.1 (Berkeley) 6/4/93";
-#else
-static char rcsid[] = "$OpenBSD: muldi3.c,v 1.6 2004/08/07 00:38:32 deraadt Exp $";
-#endif
+static char rcsid[] = "$OpenBSD: muldi3.c,v 1.7 2004/11/28 07:23:41 mickey Exp $";
#endif /* LIBC_SCCS and not lint */
#include "quad.h"
@@ -50,7 +43,7 @@ static char rcsid[] = "$OpenBSD: muldi3.c,v 1.6 2004/08/07 00:38:32 deraadt Exp
* Our algorithm is based on the following. Split incoming quad values
* u and v (where u,v >= 0) into
*
- * u = 2^n u1 * u0 (n = number of bits in `u_long', usu. 32)
+ * u = 2^n u1 * u0 (n = number of bits in `u_int', usu. 32)
*
* and
*
@@ -81,9 +74,9 @@ static char rcsid[] = "$OpenBSD: muldi3.c,v 1.6 2004/08/07 00:38:32 deraadt Exp
*
* This algorithm is from Knuth vol. 2 (2nd ed), section 4.3.3, p. 278.
*
- * Since C does not give us a `long * long = quad' operator, we split
- * our input quads into two longs, then split the two longs into two
- * shorts. We can then calculate `short * short = long' in native
+ * Since C does not give us a `int * int = quad' operator, we split
+ * our input quads into two ints, then split the two ints into two
+ * shorts. We can then calculate `short * short = int' in native
* arithmetic.
*
* Our product should, strictly speaking, be a `long quad', with 128
@@ -101,13 +94,14 @@ static char rcsid[] = "$OpenBSD: muldi3.c,v 1.6 2004/08/07 00:38:32 deraadt Exp
* of 2^n in either one will also vanish. Only `low' need be computed
* mod 2^2n, and only because of the final term above.
*/
-static quad_t __lmulq(u_long, u_long);
+static quad_t __lmulq(u_int, u_int);
quad_t
-__muldi3(quad_t a, quad_t b)
+__muldi3(a, b)
+ quad_t a, b;
{
union uu u, v, low, prod;
- u_long high, mid, udiff, vdiff;
+ u_int high, mid, udiff, vdiff;
int negall, negmid;
#define u1 u.ul[H]
#define u0 u.ul[L]
@@ -117,7 +111,7 @@ __muldi3(quad_t a, quad_t b)
/*
* Get u and v such that u, v >= 0. When this is finished,
* u1, u0, v1, and v0 will be directly accessible through the
- * longword fields.
+ * int fields.
*/
if (a >= 0)
u.q = a, negall = 0;
@@ -140,7 +134,7 @@ __muldi3(quad_t a, quad_t b)
* Compute the three intermediate products, remembering
* whether the middle term is negative. We can discard
* any upper bits in high and mid, so we can use native
- * u_long * u_long => u_long arithmetic.
+ * u_int * u_int => u_int arithmetic.
*/
low.q = __lmulq(u0, v0);
@@ -171,29 +165,27 @@ __muldi3(quad_t a, quad_t b)
}
/*
- * Multiply two 2N-bit longs to produce a 4N-bit quad, where N is half
- * the number of bits in a long (whatever that is---the code below
+ * Multiply two 2N-bit ints to produce a 4N-bit quad, where N is half
+ * the number of bits in an int (whatever that is---the code below
* does not care as long as quad.h does its part of the bargain---but
* typically N==16).
*
* We use the same algorithm from Knuth, but this time the modulo refinement
- * does not apply. On the other hand, since N is half the size of a long,
+ * does not apply. On the other hand, since N is half the size of an int,
* we can get away with native multiplication---none of our input terms
- * exceeds (ULONG_MAX >> 1).
+ * exceeds (UINT_MAX >> 1).
*
- * Note that, for u_long l, the quad-precision result
+ * Note that, for u_int l, the quad-precision result
*
* l << N
*
- * splits into high and low longs as HHALF(l) and LHUP(l) respectively.
+ * splits into high and low ints as HHALF(l) and LHUP(l) respectively.
*/
static quad_t
-__lmulq(u, v)
- u_long u;
- u_long v;
+__lmulq(u_int u, u_int v)
{
- u_long u1, u0, v1, v0, udiff, vdiff, high, mid, low;
- u_long prodh, prodl, was;
+ u_int u1, u0, v1, v0, udiff, vdiff, high, mid, low;
+ u_int prodh, prodl, was;
union uu prod;
int neg;
diff --git a/sys/lib/libkern/negdi2.c b/sys/lib/libkern/negdi2.c
index 29e91bdb1d5..91648b8131e 100644
--- a/sys/lib/libkern/negdi2.c
+++ b/sys/lib/libkern/negdi2.c
@@ -1,6 +1,3 @@
-/* $OpenBSD: negdi2.c,v 1.4 2004/08/07 00:38:32 deraadt Exp $ */
-/* $NetBSD: negdi2.c,v 1.5 1995/10/07 09:26:34 mycroft Exp $ */
-
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -35,11 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)negdi2.c 8.1 (Berkeley) 6/4/93";
-#else
-static char rcsid[] = "$OpenBSD: negdi2.c,v 1.4 2004/08/07 00:38:32 deraadt Exp $";
-#endif
+static char rcsid[] = "$OpenBSD: negdi2.c,v 1.5 2004/11/28 07:23:41 mickey Exp $";
#endif /* LIBC_SCCS and not lint */
#include "quad.h"
diff --git a/sys/lib/libkern/notdi2.c b/sys/lib/libkern/notdi2.c
index 8c2df01a8a0..14572e6a3ca 100644
--- a/sys/lib/libkern/notdi2.c
+++ b/sys/lib/libkern/notdi2.c
@@ -1,6 +1,3 @@
-/* $OpenBSD: notdi2.c,v 1.4 2004/08/07 00:38:32 deraadt Exp $ */
-/* $NetBSD: notdi2.c,v 1.5 1995/10/07 09:26:36 mycroft Exp $ */
-
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -35,11 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)notdi2.c 8.1 (Berkeley) 6/4/93";
-#else
-static char rcsid[] = "$OpenBSD: notdi2.c,v 1.4 2004/08/07 00:38:32 deraadt Exp $";
-#endif
+static char rcsid[] = "$OpenBSD: notdi2.c,v 1.5 2004/11/28 07:23:41 mickey Exp $";
#endif /* LIBC_SCCS and not lint */
#include "quad.h"
diff --git a/sys/lib/libkern/ntohl.c b/sys/lib/libkern/ntohl.c
index 081b9d2858b..08176301eea 100644
--- a/sys/lib/libkern/ntohl.c
+++ b/sys/lib/libkern/ntohl.c
@@ -1,14 +1,11 @@
-/* $OpenBSD: ntohl.c,v 1.4 2004/08/07 00:38:32 deraadt Exp $ */
-/* $NetBSD: ntohl.c,v 1.6.6.1 1996/05/29 23:48:07 cgd Exp $ */
-
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$NetBSD: ntohl.c,v 1.6.6.1 1996/05/29 23:48:07 cgd Exp $";
-#endif
+static char *rcsid = "$OpenBSD: ntohl.c,v 1.5 2004/11/28 07:23:41 mickey Exp $";
+#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
#include <machine/endian.h>
@@ -16,14 +13,13 @@ static char *rcsid = "$NetBSD: ntohl.c,v 1.6.6.1 1996/05/29 23:48:07 cgd Exp $";
#undef ntohl
u_int32_t
-ntohl(u_int32_t x)
+ntohl(x)
+ u_int32_t x;
{
- u_int32_t y = x;
-
#if BYTE_ORDER == LITTLE_ENDIAN
- u_char *s = (u_char *)&y;
+ u_char *s = (u_char *)&x;
return (u_int32_t)(s[0] << 24 | s[1] << 16 | s[2] << 8 | s[3]);
#else
- return y;
+ return x;
#endif
}
diff --git a/sys/lib/libkern/ntohs.c b/sys/lib/libkern/ntohs.c
index e677ed1ed89..1de67f63cad 100644
--- a/sys/lib/libkern/ntohs.c
+++ b/sys/lib/libkern/ntohs.c
@@ -1,14 +1,11 @@
-/* $OpenBSD: ntohs.c,v 1.4 2004/08/07 00:38:32 deraadt Exp $ */
-/* $NetBSD: ntohs.c,v 1.5.6.1 1996/05/29 23:48:11 cgd Exp $ */
-
/*
* Written by J.T. Conklin <jtc@netbsd.org>.
* Public domain.
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$NetBSD: ntohs.c,v 1.5.6.1 1996/05/29 23:48:11 cgd Exp $";
-#endif
+static char *rcsid = "$OpenBSD: ntohs.c,v 1.5 2004/11/28 07:23:41 mickey Exp $";
+#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
#include <machine/endian.h>
diff --git a/sys/lib/libkern/qdivrem.c b/sys/lib/libkern/qdivrem.c
index 64c46fe5e4b..646bc285cbd 100644
--- a/sys/lib/libkern/qdivrem.c
+++ b/sys/lib/libkern/qdivrem.c
@@ -1,6 +1,3 @@
-/* $OpenBSD: qdivrem.c,v 1.6 2004/08/07 00:38:33 deraadt Exp $ */
-/* $NetBSD: qdivrem.c,v 1.5 1995/10/07 09:26:40 mycroft Exp $ */
-
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -35,10 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-#ifdef notdef
-static char sccsid[] = "@(#)qdivrem.c 8.1 (Berkeley) 6/4/93";
-#endif
-static char rcsid[] = "$OpenBSD: qdivrem.c,v 1.6 2004/08/07 00:38:33 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: qdivrem.c,v 1.7 2004/11/28 07:23:41 mickey Exp $";
#endif /* LIBC_SCCS and not lint */
/*
@@ -48,25 +42,25 @@ static char rcsid[] = "$OpenBSD: qdivrem.c,v 1.6 2004/08/07 00:38:33 deraadt Exp
#include "quad.h"
-#define B ((long)1 << HALF_BITS) /* digit base */
+#define B ((int)1 << HALF_BITS) /* digit base */
/* Combine two `digits' to make a single two-digit number. */
-#define COMBINE(a, b) (((u_long)(a) << HALF_BITS) | (b))
+#define COMBINE(a, b) (((u_int)(a) << HALF_BITS) | (b))
/* select a type for digits in base B: use unsigned short if they fit */
-#if ULONG_MAX == 0xffffffff && USHRT_MAX >= 0xffff
+#if UINT_MAX == 0xffffffffU && USHRT_MAX >= 0xffff
typedef unsigned short digit;
#else
-typedef u_long digit;
+typedef u_int digit;
#endif
-static void shl(digit *p, int len, int sh);
+static void shl __P((digit *p, int len, int sh));
/*
* __qdivrem(u, v, rem) returns u/v and, optionally, sets *rem to u%v.
*
* We do this in base 2-sup-HALF_BITS, so that all intermediate products
- * fit within u_long. As a consequence, the maximum length dividend and
+ * fit within u_int. As a consequence, the maximum length dividend and
* divisor are 4 `digits' in this base (they are shorter if they have
* leading zeros).
*/
@@ -76,7 +70,7 @@ __qdivrem(u_quad_t uq, u_quad_t vq, u_quad_t *arq)
union uu tmp;
digit *u, *v, *q;
digit v1, v2;
- u_long qhat, rhat, t;
+ u_int qhat, rhat, t;
int m, n, d, j, i;
digit uspace[5], vspace[5], qspace[5];
@@ -116,18 +110,18 @@ __qdivrem(u_quad_t uq, u_quad_t vq, u_quad_t *arq)
*/
tmp.uq = uq;
u[0] = 0;
- u[1] = HHALF(tmp.ul[H]);
- u[2] = LHALF(tmp.ul[H]);
- u[3] = HHALF(tmp.ul[L]);
- u[4] = LHALF(tmp.ul[L]);
+ u[1] = (digit)HHALF(tmp.ul[H]);
+ u[2] = (digit)LHALF(tmp.ul[H]);
+ u[3] = (digit)HHALF(tmp.ul[L]);
+ u[4] = (digit)LHALF(tmp.ul[L]);
tmp.uq = vq;
- v[1] = HHALF(tmp.ul[H]);
- v[2] = LHALF(tmp.ul[H]);
- v[3] = HHALF(tmp.ul[L]);
- v[4] = LHALF(tmp.ul[L]);
+ v[1] = (digit)HHALF(tmp.ul[H]);
+ v[2] = (digit)LHALF(tmp.ul[H]);
+ v[3] = (digit)HHALF(tmp.ul[L]);
+ v[4] = (digit)LHALF(tmp.ul[L]);
for (n = 4; v[1] == 0; v++) {
if (--n == 1) {
- u_long rbj; /* r*B+u[j] (not root boy jim) */
+ u_int rbj; /* r*B+u[j] (not root boy jim) */
digit q1, q2, q3, q4;
/*
@@ -139,13 +133,13 @@ __qdivrem(u_quad_t uq, u_quad_t vq, u_quad_t *arq)
* We unroll this completely here.
*/
t = v[2]; /* nonzero, by definition */
- q1 = u[1] / t;
+ q1 = (digit)(u[1] / t);
rbj = COMBINE(u[1] % t, u[2]);
- q2 = rbj / t;
+ q2 = (digit)(rbj / t);
rbj = COMBINE(rbj % t, u[3]);
- q3 = rbj / t;
+ q3 = (digit)(rbj / t);
rbj = COMBINE(rbj % t, u[4]);
- q4 = rbj / t;
+ q4 = (digit)(rbj / t);
if (arq)
*arq = rbj % t;
tmp.ul[H] = COMBINE(q1, q2);
@@ -203,9 +197,9 @@ __qdivrem(u_quad_t uq, u_quad_t vq, u_quad_t *arq)
rhat = uj1;
goto qhat_too_big;
} else {
- u_long n = COMBINE(uj0, uj1);
- qhat = n / v1;
- rhat = n % v1;
+ u_int nn = COMBINE(uj0, uj1);
+ qhat = nn / v1;
+ rhat = nn % v1;
}
while (v2 * qhat > COMBINE(rhat, uj2)) {
qhat_too_big:
@@ -221,11 +215,11 @@ __qdivrem(u_quad_t uq, u_quad_t vq, u_quad_t *arq)
*/
for (t = 0, i = n; i > 0; i--) {
t = u[i + j] - v[i] * qhat - t;
- u[i + j] = LHALF(t);
+ u[i + j] = (digit)LHALF(t);
t = (B - HHALF(t)) & (B - 1);
}
t = u[j] - t;
- u[j] = LHALF(t);
+ u[j] = (digit)LHALF(t);
/*
* D5: test remainder.
* There is a borrow if and only if HHALF(t) is nonzero;
@@ -236,12 +230,12 @@ __qdivrem(u_quad_t uq, u_quad_t vq, u_quad_t *arq)
qhat--;
for (t = 0, i = n; i > 0; i--) { /* D6: add back. */
t += u[i + j] + v[i];
- u[i + j] = LHALF(t);
+ u[i + j] = (digit)LHALF(t);
t = HHALF(t);
}
- u[j] = LHALF(u[j] + t);
+ u[j] = (digit)LHALF(u[j] + t);
}
- q[j] = qhat;
+ q[j] = (digit)qhat;
} while (++j <= m); /* D7: loop on j. */
/*
@@ -252,8 +246,8 @@ __qdivrem(u_quad_t uq, u_quad_t vq, u_quad_t *arq)
if (arq) {
if (d) {
for (i = m + n; i > m; --i)
- u[i] = (u[i] >> d) |
- LHALF(u[i - 1] << (HALF_BITS - d));
+ u[i] = (digit)(((u_int)u[i] >> d) |
+ LHALF((u_int)u[i - 1] << (HALF_BITS - d)));
u[i] = 0;
}
tmp.ul[H] = COMBINE(uspace[1], uspace[2]);
@@ -277,6 +271,7 @@ shl(digit *p, int len, int sh)
int i;
for (i = 0; i < len; i++)
- p[i] = LHALF(p[i] << sh) | (p[i + 1] >> (HALF_BITS - sh));
- p[i] = LHALF(p[i] << sh);
+ p[i] = (digit)(LHALF((u_int)p[i] << sh) |
+ ((u_int)p[i + 1] >> (HALF_BITS - sh)));
+ p[i] = (digit)(LHALF((u_int)p[i] << sh));
}
diff --git a/sys/lib/libkern/quad.h b/sys/lib/libkern/quad.h
index 486b614e614..913024e489f 100644
--- a/sys/lib/libkern/quad.h
+++ b/sys/lib/libkern/quad.h
@@ -1,6 +1,3 @@
-/* $OpenBSD: quad.h,v 1.8 2003/06/02 23:28:08 millert Exp $ */
-/* $NetBSD: quad.h,v 1.7 1996/04/18 02:20:04 cgd Exp $ */
-
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -33,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * @(#)quad.h 8.1 (Berkeley) 6/4/93
+ * $OpenBSD: quad.h,v 1.9 2004/11/28 07:23:41 mickey Exp $
*/
/*
@@ -43,13 +40,13 @@
*
* - The type long long (aka quad_t) exists.
*
- * - A quad variable is exactly twice as long as `long'.
+ * - A quad variable is exactly twice as long as `int'.
*
* - The machine's arithmetic is two's complement.
*
* This library can provide 128-bit arithmetic on a machine with 128-bit
- * quads and 64-bit longs, for instance, or 96-bit arithmetic on machines
- * with 48-bit longs.
+ * quads and 64-bit ints, for instance, or 96-bit arithmetic on machines
+ * with 48-bit ints.
*/
#include <sys/types.h>
@@ -66,12 +63,12 @@
union uu {
quad_t q; /* as a (signed) quad */
u_quad_t uq; /* as an unsigned quad */
- long sl[2]; /* as two signed longs */
- u_long ul[2]; /* as two unsigned longs */
+ int sl[2]; /* as two signed ints */
+ u_int ul[2]; /* as two unsigned ints */
};
/*
- * Define high and low longwords.
+ * Define high and low parts of a quad_t.
*/
#define H _QUAD_HIGHWORD
#define L _QUAD_LOWWORD
@@ -82,23 +79,21 @@ union uu {
* and assembly.
*/
#define QUAD_BITS (sizeof(quad_t) * CHAR_BIT)
-#define LONG_BITS (sizeof(long) * CHAR_BIT)
-#define HALF_BITS (sizeof(long) * CHAR_BIT / 2)
+#define INT_BITS (sizeof(int) * CHAR_BIT)
+#define HALF_BITS (sizeof(int) * CHAR_BIT / 2)
/*
* Extract high and low shortwords from longword, and move low shortword of
* longword to upper half of long, i.e., produce the upper longword of
- * ((quad_t)(x) << (number_of_bits_in_long/2)). (`x' must actually be u_long.)
+ * ((quad_t)(x) << (number_of_bits_in_int/2)). (`x' must actually be u_int.)
*
* These are used in the multiply code, to split a longword into upper
* and lower halves, and to reassemble a product as a quad_t, shifted left
- * (sizeof(long)*CHAR_BIT/2).
+ * (sizeof(int)*CHAR_BIT/2).
*/
-#define HHALF(x) ((u_long)(x) >> HALF_BITS)
-#define LHALF(x) ((u_long)(x) & (((long)1 << HALF_BITS) - 1))
-#define LHUP(x) ((u_long)(x) << HALF_BITS)
-
-extern u_quad_t __qdivrem(u_quad_t u, u_quad_t v, u_quad_t *rem);
+#define HHALF(x) ((u_int)(x) >> HALF_BITS)
+#define LHALF(x) ((u_int)(x) & (((int)1 << HALF_BITS) - 1))
+#define LHUP(x) ((u_int)(x) << HALF_BITS)
/*
* XXX
@@ -106,29 +101,35 @@ extern u_quad_t __qdivrem(u_quad_t u, u_quad_t v, u_quad_t *rem);
* as u_quad_t, while gcc 2 correctly uses int. Unfortunately, we still use
* both compilers.
*/
-#if __GNUC__ >= 2
+#if __GNUC_PREREQ__(2, 0) || defined(lint)
typedef unsigned int qshift_t;
#else
typedef u_quad_t qshift_t;
#endif
-__BEGIN_DECLS
-quad_t __adddi3(quad_t, quad_t);
-quad_t __anddi3(quad_t, quad_t);
-quad_t __ashldi3(quad_t, qshift_t);
-quad_t __ashrdi3(quad_t, qshift_t);
-int __cmpdi2(quad_t, quad_t);
-quad_t __divdi3(quad_t, quad_t);
-quad_t __iordi3(quad_t, quad_t);
-quad_t __lshldi3(quad_t, qshift_t);
-quad_t __lshrdi3(quad_t, qshift_t);
-quad_t __moddi3(quad_t, quad_t);
-quad_t __muldi3(quad_t, quad_t);
-quad_t __negdi2(quad_t);
-quad_t __one_cmpldi2(quad_t);
-quad_t __subdi3(quad_t, quad_t);
-int __ucmpdi2(u_quad_t, u_quad_t);
-u_quad_t __udivdi3(u_quad_t, u_quad_t);
-u_quad_t __umoddi3(u_quad_t, u_quad_t);
-quad_t __xordi3(quad_t, quad_t);
-__END_DECLS
+quad_t __adddi3(quad_t, quad_t);
+quad_t __anddi3(quad_t, quad_t);
+quad_t __ashldi3(quad_t, qshift_t);
+quad_t __ashrdi3(quad_t, qshift_t);
+int __cmpdi2(quad_t, quad_t);
+quad_t __divdi3(quad_t, quad_t);
+quad_t __fixdfdi(double);
+quad_t __fixsfdi(float);
+u_quad_t __fixunsdfdi(double);
+u_quad_t __fixunssfdi(float);
+double __floatdidf(quad_t);
+float __floatdisf(quad_t);
+double __floatunsdidf(u_quad_t);
+quad_t __iordi3(quad_t, quad_t);
+quad_t __lshldi3(quad_t, qshift_t);
+quad_t __lshrdi3(quad_t, qshift_t);
+quad_t __moddi3(quad_t, quad_t);
+quad_t __muldi3(quad_t, quad_t);
+quad_t __negdi2(quad_t);
+quad_t __one_cmpldi2(quad_t);
+u_quad_t __qdivrem(u_quad_t, u_quad_t, u_quad_t *);
+quad_t __subdi3(quad_t, quad_t);
+int __ucmpdi2(u_quad_t, u_quad_t);
+u_quad_t __udivdi3(u_quad_t, u_quad_t );
+u_quad_t __umoddi3(u_quad_t, u_quad_t );
+quad_t __xordi3(quad_t, quad_t);
diff --git a/sys/lib/libkern/strcat.c b/sys/lib/libkern/strcat.c
index 88cfad0cfb7..7d058e9e68f 100644
--- a/sys/lib/libkern/strcat.c
+++ b/sys/lib/libkern/strcat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: strcat.c,v 1.8 2004/08/07 00:38:33 deraadt Exp $ */
+/* $OpenBSD: strcat.c,v 1.9 2004/11/28 07:23:41 mickey Exp $ */
/*
* Copyright (c) 1988 Regents of the University of California.
@@ -30,8 +30,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-/*static char *sccsid = "from: @(#)strcat.c 5.6 (Berkeley) 2/24/91";*/
-static char *rcsid = "$OpenBSD: strcat.c,v 1.8 2004/08/07 00:38:33 deraadt Exp $";
+static char *rcsid = "$OpenBSD: strcat.c,v 1.9 2004/11/28 07:23:41 mickey Exp $";
#endif /* LIBC_SCCS and not lint */
#if !defined(_KERNEL) && !defined(_STANDALONE)
@@ -40,16 +39,17 @@ static char *rcsid = "$OpenBSD: strcat.c,v 1.8 2004/08/07 00:38:33 deraadt Exp $
#include <lib/libkern/libkern.h>
#endif
-__warn_references(strcat, "warning: strcat() is often misused, please use strlcpy()");
+#if defined(APIWARN)
+__warn_references(strcat,
+ "warning: strcat() is almost always misused, please use strlcat()");
+#endif
char *
strcat(char *s, const char *append)
{
char *save = s;
- for (; *s; ++s)
- ;
- while ((*s++ = *append++) != '\0')
- ;
+ for (; *s; ++s);
+ while ((*s++ = *append++) != '\0');
return(save);
}
diff --git a/sys/lib/libkern/strcmp.c b/sys/lib/libkern/strcmp.c
index c38e2e55301..f9973e18720 100644
--- a/sys/lib/libkern/strcmp.c
+++ b/sys/lib/libkern/strcmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: strcmp.c,v 1.8 2004/08/07 00:38:33 deraadt Exp $ */
+/* $OpenBSD: strcmp.c,v 1.9 2004/11/28 07:23:41 mickey Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -33,11 +33,9 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-/*static char *sccsid = "from: @(#)strcmp.c 5.5 (Berkeley) 1/26/91";*/
-static char *rcsid = "$OpenBSD: strcmp.c,v 1.8 2004/08/07 00:38:33 deraadt Exp $";
+static char *rcsid = "$OpenBSD: strcmp.c,v 1.9 2004/11/28 07:23:41 mickey Exp $";
#endif /* LIBC_SCCS and not lint */
-#include <sys/types.h>
#if !defined(_KERNEL) && !defined(_STANDALONE)
#include <string.h>
#else
@@ -49,10 +47,9 @@ static char *rcsid = "$OpenBSD: strcmp.c,v 1.8 2004/08/07 00:38:33 deraadt Exp $
*/
int
strcmp(const char *s1, const char *s2)
-
{
while (*s1 == *s2++)
if (*s1++ == 0)
return (0);
- return (*(const u_char *)s1 - *(const u_char *)--s2);
+ return (*(unsigned char *)s1 - *(unsigned char *)--s2);
}
diff --git a/sys/lib/libkern/strcpy.c b/sys/lib/libkern/strcpy.c
index e7dc46ab90a..8ff5dcbbae2 100644
--- a/sys/lib/libkern/strcpy.c
+++ b/sys/lib/libkern/strcpy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: strcpy.c,v 1.8 2004/08/07 00:38:33 deraadt Exp $ */
+/* $OpenBSD: strcpy.c,v 1.9 2004/11/28 07:23:41 mickey Exp $ */
/*
* Copyright (c) 1988 Regents of the University of California.
@@ -30,8 +30,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-/*static char *sccsid = "from: @(#)strcpy.c 5.7 (Berkeley) 2/24/91";*/
-static char *rcsid = "$OpenBSD: strcpy.c,v 1.8 2004/08/07 00:38:33 deraadt Exp $";
+static char *rcsid = "$OpenBSD: strcpy.c,v 1.9 2004/11/28 07:23:41 mickey Exp $";
#endif /* LIBC_SCCS and not lint */
#if !defined(_KERNEL) && !defined(_STANDALONE)
@@ -40,7 +39,10 @@ static char *rcsid = "$OpenBSD: strcpy.c,v 1.8 2004/08/07 00:38:33 deraadt Exp $
#include <lib/libkern/libkern.h>
#endif
-__warn_references(strcpy, "warning: strcpy() is often misused, please use strlcpy()");
+#if defined(APIWARN)
+__warn_references(strcpy,
+ "warning: strcpy() is almost always misused, please use strlcpy()");
+#endif
char *
strcpy(char *to, const char *from)
diff --git a/sys/lib/libkern/strlen.c b/sys/lib/libkern/strlen.c
index 9b7fea786ed..d45481524a6 100644
--- a/sys/lib/libkern/strlen.c
+++ b/sys/lib/libkern/strlen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: strlen.c,v 1.7 2004/08/07 00:38:33 deraadt Exp $ */
+/* $OpenBSD: strlen.c,v 1.8 2004/11/28 07:23:41 mickey Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -30,7 +30,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: strlen.c,v 1.7 2004/08/07 00:38:33 deraadt Exp $";
+static char *rcsid = "$OpenBSD: strlen.c,v 1.8 2004/11/28 07:23:41 mickey Exp $";
#endif /* LIBC_SCCS and not lint */
#if !defined(_KERNEL) && !defined(_STANDALONE)
diff --git a/sys/lib/libkern/strncmp.c b/sys/lib/libkern/strncmp.c
index 78462928dfd..4101edf8bab 100644
--- a/sys/lib/libkern/strncmp.c
+++ b/sys/lib/libkern/strncmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: strncmp.c,v 1.8 2004/08/07 00:38:33 deraadt Exp $ */
+/* $OpenBSD: strncmp.c,v 1.9 2004/11/28 07:23:41 mickey Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
@@ -30,11 +30,9 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-/*static char *sccsid = "from: @(#)strncmp.c 5.6 (Berkeley) 1/26/91";*/
-static char *rcsid = "$OpenBSD: strncmp.c,v 1.8 2004/08/07 00:38:33 deraadt Exp $";
+static char *rcsid = "$OpenBSD: strncmp.c,v 1.9 2004/11/28 07:23:41 mickey Exp $";
#endif /* LIBC_SCCS and not lint */
-#include <sys/types.h>
#if !defined(_KERNEL) && !defined(_STANDALONE)
#include <string.h>
#else
@@ -49,7 +47,7 @@ strncmp(const char *s1, const char *s2, size_t n)
return (0);
do {
if (*s1 != *s2++)
- return (*(const u_char *)s1 - *(const u_char *)--s2);
+ return (*(unsigned char *)s1 - *(unsigned char *)--s2);
if (*s1++ == 0)
break;
} while (--n != 0);
diff --git a/sys/lib/libkern/strncpy.c b/sys/lib/libkern/strncpy.c
index 97e778ef067..906bf99e19b 100644
--- a/sys/lib/libkern/strncpy.c
+++ b/sys/lib/libkern/strncpy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: strncpy.c,v 1.6 2004/08/07 00:38:33 deraadt Exp $ */
+/* $OpenBSD: strncpy.c,v 1.7 2004/11/28 07:23:41 mickey Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -33,8 +33,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-/*static char *sccsid = "from: @(#)strncpy.c 5.6 (Berkeley) 1/26/91";*/
-static char *rcsid = "$OpenBSD: strncpy.c,v 1.6 2004/08/07 00:38:33 deraadt Exp $";
+static char *rcsid = "$OpenBSD: strncpy.c,v 1.7 2004/11/28 07:23:41 mickey Exp $";
#endif /* LIBC_SCCS and not lint */
#if !defined(_KERNEL) && !defined(_STANDALONE)
diff --git a/sys/lib/libkern/subdi3.c b/sys/lib/libkern/subdi3.c
index 54353825448..606e9d7f77b 100644
--- a/sys/lib/libkern/subdi3.c
+++ b/sys/lib/libkern/subdi3.c
@@ -1,6 +1,3 @@
-/* $OpenBSD: subdi3.c,v 1.4 2004/08/07 00:38:33 deraadt Exp $ */
-/* $NetBSD: subdi3.c,v 1.5 1995/10/07 09:26:52 mycroft Exp $ */
-
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -35,18 +32,14 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)subdi3.c 8.1 (Berkeley) 6/4/93";
-#else
-static char rcsid[] = "$OpenBSD: subdi3.c,v 1.4 2004/08/07 00:38:33 deraadt Exp $";
-#endif
+static char rcsid[] = "$OpenBSD: subdi3.c,v 1.5 2004/11/28 07:23:41 mickey Exp $";
#endif /* LIBC_SCCS and not lint */
#include "quad.h"
/*
* Subtract two quad values. This is trivial since a one-bit carry
- * from a single u_long difference x-y occurs if and only if (x-y) > x.
+ * from a single u_int difference x-y occurs if and only if (x-y) > x.
*/
quad_t
__subdi3(quad_t a, quad_t b)
diff --git a/sys/lib/libkern/ucmpdi2.c b/sys/lib/libkern/ucmpdi2.c
index 00e1b7aad7e..c77f666d2e8 100644
--- a/sys/lib/libkern/ucmpdi2.c
+++ b/sys/lib/libkern/ucmpdi2.c
@@ -1,6 +1,3 @@
-/* $OpenBSD: ucmpdi2.c,v 1.4 2004/08/07 00:38:33 deraadt Exp $ */
-/* $NetBSD: ucmpdi2.c,v 1.5 1995/10/07 09:26:53 mycroft Exp $ */
-
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -35,11 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)ucmpdi2.c 8.1 (Berkeley) 6/4/93";
-#else
-static char rcsid[] = "$OpenBSD: ucmpdi2.c,v 1.4 2004/08/07 00:38:33 deraadt Exp $";
-#endif
+static char rcsid[] = "$OpenBSD: ucmpdi2.c,v 1.5 2004/11/28 07:23:41 mickey Exp $";
#endif /* LIBC_SCCS and not lint */
#include "quad.h"
diff --git a/sys/lib/libkern/udivdi3.c b/sys/lib/libkern/udivdi3.c
index 6f7e657c05e..138f272be71 100644
--- a/sys/lib/libkern/udivdi3.c
+++ b/sys/lib/libkern/udivdi3.c
@@ -1,6 +1,3 @@
-/* $OpenBSD: udivdi3.c,v 1.4 2004/08/07 00:38:33 deraadt Exp $ */
-/* $NetBSD: udivdi3.c,v 1.5 1995/10/07 09:26:54 mycroft Exp $ */
-
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -35,11 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)udivdi3.c 8.1 (Berkeley) 6/4/93";
-#else
-static char rcsid[] = "$OpenBSD: udivdi3.c,v 1.4 2004/08/07 00:38:33 deraadt Exp $";
-#endif
+static char rcsid[] = "$OpenBSD: udivdi3.c,v 1.5 2004/11/28 07:23:41 mickey Exp $";
#endif /* LIBC_SCCS and not lint */
#include "quad.h"
diff --git a/sys/lib/libkern/umoddi3.c b/sys/lib/libkern/umoddi3.c
index 226b926e81c..3265e1defdc 100644
--- a/sys/lib/libkern/umoddi3.c
+++ b/sys/lib/libkern/umoddi3.c
@@ -1,6 +1,3 @@
-/* $OpenBSD: umoddi3.c,v 1.4 2004/08/07 00:38:33 deraadt Exp $ */
-/* $NetBSD: umoddi3.c,v 1.5 1995/10/07 09:26:55 mycroft Exp $ */
-
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -35,11 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)umoddi3.c 8.1 (Berkeley) 6/4/93";
-#else
-static char rcsid[] = "$OpenBSD: umoddi3.c,v 1.4 2004/08/07 00:38:33 deraadt Exp $";
-#endif
+static char rcsid[] = "$OpenBSD: umoddi3.c,v 1.5 2004/11/28 07:23:41 mickey Exp $";
#endif /* LIBC_SCCS and not lint */
#include "quad.h"
diff --git a/sys/lib/libkern/xordi3.c b/sys/lib/libkern/xordi3.c
index cc0f1b11e09..13a8f53aa3b 100644
--- a/sys/lib/libkern/xordi3.c
+++ b/sys/lib/libkern/xordi3.c
@@ -1,6 +1,3 @@
-/* $OpenBSD: xordi3.c,v 1.4 2004/08/07 00:38:33 deraadt Exp $ */
-/* $NetBSD: xordi3.c,v 1.5 1995/10/07 09:26:56 mycroft Exp $ */
-
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -35,11 +32,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)xordi3.c 8.1 (Berkeley) 6/4/93";
-#else
-static char rcsid[] = "$OpenBSD: xordi3.c,v 1.4 2004/08/07 00:38:33 deraadt Exp $";
-#endif
+static char rcsid[] = "$OpenBSD: xordi3.c,v 1.5 2004/11/28 07:23:41 mickey Exp $";
#endif /* LIBC_SCCS and not lint */
#include "quad.h"