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
path: root/core/src
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2014-04-11 06:36:22 +0400
committerPeter Dettman <peter.dettman@bouncycastle.org>2014-04-11 06:36:22 +0400
commitda4d2549489179ef69da1f435539ee9c7dcda62c (patch)
tree5c5bede788a695c48db9d02a07ac932a9b01fb2f /core/src
parente897041d02aac63df7181ceaa1c9af1dfcb48c4a (diff)
Simplify logic in getNafWeight
Diffstat (limited to 'core/src')
-rw-r--r--core/src/main/java/org/bouncycastle/math/ec/WNafUtil.java12
1 files changed, 1 insertions, 11 deletions
diff --git a/core/src/main/java/org/bouncycastle/math/ec/WNafUtil.java b/core/src/main/java/org/bouncycastle/math/ec/WNafUtil.java
index 7db5c1de..7ac3160c 100644
--- a/core/src/main/java/org/bouncycastle/math/ec/WNafUtil.java
+++ b/core/src/main/java/org/bouncycastle/math/ec/WNafUtil.java
@@ -293,17 +293,7 @@ public abstract class WNafUtil
BigInteger _3k = k.shiftLeft(1).add(k);
BigInteger diff = _3k.xor(k);
- int highBit = _3k.bitLength() - 1, length = 1;
- for (int i = 1; i < highBit; ++i)
- {
- if (diff.testBit(i))
- {
- ++length;
- ++i;
- }
- }
-
- return length;
+ return diff.bitCount();
}
public static WNafPreCompInfo getWNafPreCompInfo(ECPoint p)