summary refs log tree commit diff
path: root/crypto/src/util/Integers.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2021-08-07 20:35:20 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2021-08-07 20:35:20 +0700
commit94a215651b23921043cb3d7d41550ea49dd7a79c (patch)
tree5b498f9b9462f029e9c7616fde43293d1170e93e /crypto/src/util/Integers.cs
parentFix Encode return values (diff)
downloadBouncyCastle.NET-ed25519-94a215651b23921043cb3d7d41550ea49dd7a79c.tar.xz
Cleanup after bc-fips-csharp updates
Diffstat (limited to 'crypto/src/util/Integers.cs')
-rw-r--r--crypto/src/util/Integers.cs22
1 files changed, 17 insertions, 5 deletions
diff --git a/crypto/src/util/Integers.cs b/crypto/src/util/Integers.cs
index cc46862bd..efa437e17 100644
--- a/crypto/src/util/Integers.cs
+++ b/crypto/src/util/Integers.cs
@@ -37,16 +37,28 @@ namespace Org.BouncyCastle.Utilities
 
         public static int Reverse(int i)
         {
-            i = (int)Bits.BitPermuteStepSimple((uint)i, 0x55555555U, 1);
-            i = (int)Bits.BitPermuteStepSimple((uint)i, 0x33333333U, 2);
-            i = (int)Bits.BitPermuteStepSimple((uint)i, 0x0F0F0F0FU, 4);
+            return (int)Reverse((uint)i);
+        }
+
+        [CLSCompliantAttribute(false)]
+        public static uint Reverse(uint i)
+        {
+            i = Bits.BitPermuteStepSimple(i, 0x55555555U, 1);
+            i = Bits.BitPermuteStepSimple(i, 0x33333333U, 2);
+            i = Bits.BitPermuteStepSimple(i, 0x0F0F0F0FU, 4);
             return ReverseBytes(i);
         }
 
         public static int ReverseBytes(int i)
         {
-            return RotateLeft((int)((uint)i & 0xFF00FF00U),  8) |
-                   RotateLeft((int)((uint)i & 0x00FF00FFU), 24);
+            return (int)ReverseBytes((uint)i);
+        }
+
+        [CLSCompliantAttribute(false)]
+        public static uint ReverseBytes(uint i)
+        {
+            return RotateLeft(i & 0xFF00FF00U,  8) |
+                   RotateLeft(i & 0x00FF00FFU, 24);
         }
 
         public static int RotateLeft(int i, int distance)