Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/quite/humla-spongycastle.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2014-02-27 08:16:31 +0400
committerPeter Dettman <peter.dettman@bouncycastle.org>2014-02-27 08:16:31 +0400
commit8d7e53b43dbd1316bf4e3035fee35d8bc69bef3b (patch)
tree786b6214788ec19e1e73a061b2e9245a82cbd09a /core/src/main/java/org/bouncycastle
parent8f9e39574235b64f2003a649e967dd34fabacf01 (diff)
Simplify twice()
Diffstat (limited to 'core/src/main/java/org/bouncycastle')
-rw-r--r--core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP521R1Field.java10
1 files changed, 3 insertions, 7 deletions
diff --git a/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP521R1Field.java b/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP521R1Field.java
index 1608d406..df353034 100644
--- a/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP521R1Field.java
+++ b/core/src/main/java/org/bouncycastle/math/ec/custom/sec/SecP521R1Field.java
@@ -133,13 +133,9 @@ public class SecP521R1Field
public static void twice(int[] x, int[] z)
{
- int c = Nat.shiftUpBit(16, x, 0, z) | (x[16] << 1);
- if (c > P16 || (c == P16 && Nat.eq(16, z, P)))
- {
- c += Nat.inc(16, z, 0);
- c &= P16;
- }
- z[16] = c;
+ int x16 = x[16];
+ int c = Nat.shiftUpBit(16, x, x16 << 23, z) | (x16 << 1);
+ z[16] = c & P16;
}
protected static void implMultiply(int[] x, int[] y, int[] zz)