[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] Patch: FYI: PR 9946
From: |
Tom Tromey |
Subject: |
[cp-patches] Patch: FYI: PR 9946 |
Date: |
16 Aug 2004 20:43:02 -0600 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 |
I'm checking this in.
This fixes bug 9946. We were incorrectly ignoring the return result
from BigInteger.add().
Tom
Index: ChangeLog
from Tom Tromey <address@hidden>
Bug 9946.
* gnu/java/security/util/Prime.java (generateRandomPrime): Use
return result from `add'.
2004-08-16 Tom Tromey <address@hidden>
Index: gnu/java/security/util/Prime.java
===================================================================
RCS file: /cvsroot/classpath/classpath/gnu/java/security/util/Prime.java,v
retrieving revision 1.3
diff -u -r1.3 Prime.java
--- gnu/java/security/util/Prime.java 22 Jan 2002 22:26:58 -0000 1.3
+++ gnu/java/security/util/Prime.java 17 Aug 2004 02:59:28 -0000
@@ -1,5 +1,5 @@
/* Prime.java --- Prime number generation utilities
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -55,12 +55,12 @@
BigInteger p = new BigInteger( (pmax + pmin)/2, new Random() );
if( p.compareTo( BigInteger.valueOf( 1 ).shiftLeft( pmin ) ) <= 0 )
{
- p.add( BigInteger.valueOf( 1 ).shiftLeft( pmin ).subtract( p ) );
+ p = p.add( BigInteger.valueOf( 1 ).shiftLeft( pmin ).subtract( p ) );
}
//Step 2 - test for even
if( p.mod( BigInteger.valueOf(2) ).compareTo( BigInteger.valueOf( 0 )) ==
0)
- p.add( BigInteger.valueOf( 1 ) );
+ p = p.add( BigInteger.valueOf( 1 ) );
for(;;)
{
@@ -76,7 +76,7 @@
// put step 2 code here so looping code is cleaner
//Step 2 - test for even
if( p.mod( BigInteger.valueOf(2) ).compareTo( BigInteger.valueOf( 0
)) == 0)
- p.add( BigInteger.valueOf( 1 ) );
+ p = p.add( BigInteger.valueOf( 1 ) );
continue;
}
@@ -122,7 +122,7 @@
//Step 4 - test for even
if( p.mod( BigInteger.valueOf(2) ).compareTo( BigInteger.valueOf( 0 ))
== 0)
- p.add( r );
+ p = p.add( r );
for(;;)
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [cp-patches] Patch: FYI: PR 9946,
Tom Tromey <=