diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2014-02-05 10:04:58 +0400 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2014-02-05 10:04:58 +0400 |
commit | a06eae343120e605978c3008185a3f0367f4db3d (patch) | |
tree | ac691bfa359fa7d670e669c1ac1804316e0fefe5 /core/src/main/java/org/bouncycastle/math | |
parent | d466256e0c56c4a9bd2505d4ce3367122b6a4ad9 (diff) |
Add a shiftUpBit variation
Diffstat (limited to 'core/src/main/java/org/bouncycastle/math')
-rw-r--r-- | core/src/main/java/org/bouncycastle/math/ec/Nat.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/core/src/main/java/org/bouncycastle/math/ec/Nat.java b/core/src/main/java/org/bouncycastle/math/ec/Nat.java index 5a816c86..6915b79b 100644 --- a/core/src/main/java/org/bouncycastle/math/ec/Nat.java +++ b/core/src/main/java/org/bouncycastle/math/ec/Nat.java @@ -365,6 +365,17 @@ public abstract class Nat return c >>> 31; } + public static int shiftUpBit(int len, int[] x, int xOff, int c, int[] z) + { + for (int i = 0; i < len; ++i) + { + int next = x[xOff + i]; + z[i] = (next << 1) | (c >>> 31); + c = next; + } + return c >>> 31; + } + public static int shiftUpBits(int len, int[] z, int bits, int c) { // assert bits > 0 && bits < 32; |