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-01-05 15:37:11 +0400
committerPeter Dettman <peter.dettman@bouncycastle.org>2014-01-05 15:37:11 +0400
commit96b4d9571c71a4471479d941b1db71347842b707 (patch)
tree4e9bd09e3d70fc40eb09d41966f59967484b36c4
parente6697907b17d71b33e32ad15160627aa01b7fe5e (diff)
Implement Integers rotate methods for J2ME and JDK 1.4
-rw-r--r--core/src/main/j2me/org/bouncycastle/util/Integers.java10
-rw-r--r--core/src/main/jdk1.4/org/bouncycastle/util/Integers.java10
2 files changed, 20 insertions, 0 deletions
diff --git a/core/src/main/j2me/org/bouncycastle/util/Integers.java b/core/src/main/j2me/org/bouncycastle/util/Integers.java
index 2b9aaee0..e461a77c 100644
--- a/core/src/main/j2me/org/bouncycastle/util/Integers.java
+++ b/core/src/main/j2me/org/bouncycastle/util/Integers.java
@@ -2,6 +2,16 @@ package org.bouncycastle.util;
public class Integers
{
+ public static int rotateLeft(int i, int distance)
+ {
+ return (i << distance) ^ (i >>> -distance);
+ }
+
+ public static int rotateRight(int i, int distance)
+ {
+ return (i >>> distance) ^ (i << -distance);
+ }
+
public static Integer valueOf(int value)
{
return new Integer(value);
diff --git a/core/src/main/jdk1.4/org/bouncycastle/util/Integers.java b/core/src/main/jdk1.4/org/bouncycastle/util/Integers.java
index 2b9aaee0..e461a77c 100644
--- a/core/src/main/jdk1.4/org/bouncycastle/util/Integers.java
+++ b/core/src/main/jdk1.4/org/bouncycastle/util/Integers.java
@@ -2,6 +2,16 @@ package org.bouncycastle.util;
public class Integers
{
+ public static int rotateLeft(int i, int distance)
+ {
+ return (i << distance) ^ (i >>> -distance);
+ }
+
+ public static int rotateRight(int i, int distance)
+ {
+ return (i >>> distance) ^ (i << -distance);
+ }
+
public static Integer valueOf(int value)
{
return new Integer(value);