From 0d74a23f78cc18401b5f746a97faf1f43003655f Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Tue, 21 Jan 2014 16:19:11 +0700 Subject: Add new classes in Math.Field and some other EC-related stuff from Java --- crypto/src/util/Integers.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 crypto/src/util/Integers.cs (limited to 'crypto/src/util') diff --git a/crypto/src/util/Integers.cs b/crypto/src/util/Integers.cs new file mode 100644 index 000000000..ccbf872c4 --- /dev/null +++ b/crypto/src/util/Integers.cs @@ -0,0 +1,17 @@ +using System; + +namespace Org.BouncyCastle.Utilities +{ + public abstract class Integers + { + public static int RotateLeft(int i, int distance) + { + return (i << distance) ^ (int)((uint)i >> -distance); + } + + public static int RotateRight(int i, int distance) + { + return (int)((uint)i >> distance) ^ (i << -distance); + } + } +} -- cgit 1.5.1