[Commit] nickle ChangeLog,1.19,1.20 gcd.c,1.15,1.16
Keith Packard
commit at keithp.com
Thu Apr 1 14:06:04 PST 2004
Committed by: keithp
Update of /local/src/CVS/nickle
In directory home.keithp.com:/tmp/cvs-serv29038
Modified Files:
ChangeLog gcd.c
Log Message:
2004-04-01 Keith Packard <keithp at keithp.com>
* gcd.c: (NaturalRslInplace), (NaturalBdivmodInplace):
Ouch. NaturalRslInplace was not checking argument
for zero
Index: ChangeLog
===================================================================
RCS file: /local/src/CVS/nickle/ChangeLog,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- a/ChangeLog 1 Apr 2004 19:49:56 -0000 1.19
+++ b/ChangeLog 1 Apr 2004 22:06:01 -0000 1.20
@@ -1,5 +1,11 @@
2004-04-01 Keith Packard <keithp at keithp.com>
+ * gcd.c: (NaturalRslInplace), (NaturalBdivmodInplace):
+ Ouch. NaturalRslInplace was not checking argument
+ for zero
+
+2004-04-01 Keith Packard <keithp at keithp.com>
+
reviewed by: Mike Harris <mharris at redhat.com>
* .cvsignore:
Index: gcd.c
===================================================================
RCS file: /local/src/CVS/nickle/gcd.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- a/gcd.c 27 Feb 2004 03:50:16 -0000 1.15
+++ b/gcd.c 1 Apr 2004 22:06:01 -0000 1.16
@@ -65,12 +65,12 @@
length = v->length - dshift;
index = length;
last = 1;
- if ((NaturalDigits(v)[v->length - 1] >> shift) == 0)
+ if (length > 0 && (NaturalDigits(v)[v->length - 1] >> shift) == 0)
{
length--;
last = 0;
}
- if (length < 0)
+ if (length <= 0)
{
v->length = 0;
return;
@@ -371,13 +371,13 @@
}
if (bits)
{
- digit dmask = (1 << bits) - 1;
+ digit dmask = ((digit) 1 << bits) - 1;
+ q0 = ((NaturalDigits(u)[0] & dmask) * v0_inv) & dmask;
#ifdef DEBUG_BDIVMOD
- FilePrintf (FileStdout, "u[0] %x q0 %x\n",
- NaturalDigits(u)[0], q0);
+ FilePrintf (FileStdout, "u[0] %x q0 %x dmask %x\n",
+ NaturalDigits(u)[0], q0, dmask);
#endif
- q0 = ((NaturalDigits(u)[0] & dmask) * v0_inv) & dmask;
if (q0)
NaturalBdivmodStepInplace (u, v, q0, False);
NaturalRslInplace (u, bits);
More information about the Commit
mailing list