diff options
author | Tom Tromey <tromey@redhat.com> | 2004-08-30 17:29:48 +0000 |
---|---|---|
committer | Andreas Tobler <andreast@gcc.gnu.org> | 2004-08-30 19:29:48 +0200 |
commit | b6e9851af8002d984ae10a8ff8c36d7a113f0a51 (patch) | |
tree | f99bf3db247a5da7163bc30cf211f4bbb3817b7a | |
parent | a23adb4d00857dd9ac5e4915ba1baceb586e8bf8 (diff) | |
download | gcc-b6e9851af8002d984ae10a8ff8c36d7a113f0a51.zip gcc-b6e9851af8002d984ae10a8ff8c36d7a113f0a51.tar.gz gcc-b6e9851af8002d984ae10a8ff8c36d7a113f0a51.tar.bz2 |
Prime.java (generateRandomPrime): Use return result from `add'.
2004-08-30 Tom Tromey <tromey@redhat.com>
* gnu/java/security/util/Prime.java (generateRandomPrime): Use
return result from `add'.
From-SVN: r86787
-rw-r--r-- | libjava/ChangeLog | 5 | ||||
-rw-r--r-- | libjava/gnu/java/security/util/Prime.java | 10 |
2 files changed, 10 insertions, 5 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 44d9ce4..deaee8c 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,5 +1,10 @@ 2004-08-30 Tom Tromey <tromey@redhat.com> + * gnu/java/security/util/Prime.java (generateRandomPrime): Use + return result from `add'. + +2004-08-30 Tom Tromey <tromey@redhat.com> + * java/rmi/server/UID.java (UID): Read `nextCount', not count. 2004-08-30 Andreas Tobler <a.tobler@schweiz.ch> diff --git a/libjava/gnu/java/security/util/Prime.java b/libjava/gnu/java/security/util/Prime.java index 06d059e..2184602 100644 --- a/libjava/gnu/java/security/util/Prime.java +++ b/libjava/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(;;) { |