diff options
author | Tom Tromey <tromey@redhat.com> | 2004-08-17 03:00:58 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2004-08-17 03:00:58 +0000 |
commit | 711ea9faa4df5cb2b80935b1803a986f4de4c863 (patch) | |
tree | 228ad1656a037636486d04bda9a473c584faa339 /gnu/java/security | |
parent | e9aa879a8513672327ab17e02ce5ab76cf388b8c (diff) | |
download | classpath-711ea9faa4df5cb2b80935b1803a986f4de4c863.tar.gz |
Bug 9946.
* gnu/java/security/util/Prime.java (generateRandomPrime): Use
return result from `add'.
Diffstat (limited to 'gnu/java/security')
-rw-r--r-- | gnu/java/security/util/Prime.java | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/gnu/java/security/util/Prime.java b/gnu/java/security/util/Prime.java index 06d059e1e..2184602f6 100644 --- a/gnu/java/security/util/Prime.java +++ b/gnu/java/security/util/Prime.java @@ -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 @@ public final class Prime 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 @@ public final class Prime // 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 @@ public final class Prime //Step 4 - test for even if( p.mod( BigInteger.valueOf(2) ).compareTo( BigInteger.valueOf( 0 )) == 0) - p.add( r ); + p = p.add( r ); for(;;) { |