summaryrefslogtreecommitdiff
path: root/sys/lib/libkern
diff options
context:
space:
mode:
authorpk <pk@NetBSD.org>1995-04-22 09:37:39 +0000
committerpk <pk@NetBSD.org>1995-04-22 09:37:39 +0000
commit1778fc8e4a6db130ed28b38ee2f2e6d82ebfae32 (patch)
tree1c73d14d81a4872b61548bc944ecd6cc500df89d /sys/lib/libkern
parenta3fa60161e4e928dddfd2cd6a7810fab6d07b679 (diff)
eserve the equality "x == y*(x/y)+(x%y)" for negative y; from Lon Willett.
Diffstat (limited to 'sys/lib/libkern')
-rw-r--r--sys/lib/libkern/arch/sparc/divrem.m48
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/lib/libkern/arch/sparc/divrem.m4 b/sys/lib/libkern/arch/sparc/divrem.m4
index af792257367..b5aee6e4274 100644
--- a/sys/lib/libkern/arch/sparc/divrem.m4
+++ b/sys/lib/libkern/arch/sparc/divrem.m4
@@ -1,4 +1,4 @@
-/* $NetBSD: divrem.m4,v 1.2 1994/10/26 06:39:56 cgd Exp $ */
+/* $NetBSD: divrem.m4,v 1.3 1995/04/22 09:37:39 pk Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -48,7 +48,7 @@
#ifdef notdef
.asciz "@(#)divrem.m4 8.1 (Berkeley) 6/4/93"
#endif
- .asciz "$NetBSD: divrem.m4,v 1.2 1994/10/26 06:39:56 cgd Exp $"
+ .asciz "$NetBSD: divrem.m4,v 1.3 1995/04/22 09:37:39 pk Exp $"
#endif /* LIBC_SCCS and not lint */
/*
@@ -140,7 +140,9 @@ ifelse(S, `true',
` ! compute sign of result; if neither is negative, no problem
orcc divisor, dividend, %g0 ! either negative?
bge 2f ! no, go do the divide
- xor divisor, dividend, SIGN ! compute sign in any case
+ ifelse(OP, `div',
+ `xor divisor, dividend, SIGN',
+ `mov dividend, SIGN') ! compute sign in any case
tst divisor
bge 1f
tst dividend