diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2013-09-30 16:32:08 +0400 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2013-09-30 16:32:08 +0400 |
commit | f13fc4a6f8be3f1f17d9981f61ca8fc45ecc62f2 (patch) | |
tree | eaf9e44fae70bdae78c2512e35cb721fde2cba6c /core/src/main/java/org/bouncycastle/math | |
parent | c89584cdfc1d020b5273e6e70010f70009ab0708 (diff) |
Provide internal method addShiftedByWordsQuick for use in the inner loop
of multiply where we don't need the bounds checking
Diffstat (limited to 'core/src/main/java/org/bouncycastle/math')
-rw-r--r-- | core/src/main/java/org/bouncycastle/math/ec/IntArray.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/core/src/main/java/org/bouncycastle/math/ec/IntArray.java b/core/src/main/java/org/bouncycastle/math/ec/IntArray.java index cc725d69..11af2cfd 100644 --- a/core/src/main/java/org/bouncycastle/math/ec/IntArray.java +++ b/core/src/main/java/org/bouncycastle/math/ec/IntArray.java @@ -373,6 +373,15 @@ class IntArray } } + private void addShiftedByWordsQuick(IntArray other, int words) + { + int otherLen = other.m_ints.length; + for (int i = 0; i < otherLen; ++i) + { + m_ints[words + i] ^= other.m_ints[i]; + } + } + public int getLength() { return m_ints.length; @@ -522,7 +531,7 @@ class IntArray if ((m_ints[j] & testBit) != 0) { // The kth bit of m_ints[j] is set - c.addShiftedByWords(b, j); + c.addShiftedByWordsQuick(b, j); } } if ((testBit <<= 1) == 0) |