summary refs log tree commit diff
path: root/crypto/src/pqc/crypto/cmce/Utils.cs
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/src/pqc/crypto/cmce/Utils.cs')
-rw-r--r--crypto/src/pqc/crypto/cmce/Utils.cs9
1 files changed, 3 insertions, 6 deletions
diff --git a/crypto/src/pqc/crypto/cmce/Utils.cs b/crypto/src/pqc/crypto/cmce/Utils.cs
index 0ebe168b1..019425cb9 100644
--- a/crypto/src/pqc/crypto/cmce/Utils.cs
+++ b/crypto/src/pqc/crypto/cmce/Utils.cs
@@ -1,8 +1,9 @@
 using Org.BouncyCastle.Crypto.Utilities;
+using Org.BouncyCastle.Utilities;
 
 namespace Org.BouncyCastle.Pqc.Crypto.Cmce
 {
-    internal class Utils
+    internal static class Utils
     {
         internal static void StoreGF(byte[] dest, int offset, ushort a)
         {
@@ -41,11 +42,7 @@ namespace Org.BouncyCastle.Pqc.Crypto.Cmce
 
         internal static ushort Bitrev(ushort a, int GFBITS)
         {
-            a = (ushort) (((a & 0x00FF) << 8) | ((a & 0xFF00) >> 8));
-            a = (ushort) (((a & 0x0F0F) << 4) | ((a & 0xF0F0) >> 4));
-            a = (ushort) (((a & 0x3333) << 2) | ((a & 0xCCCC) >> 2));
-            a = (ushort) (((a & 0x5555) << 1) | ((a & 0xAAAA) >> 1));
-            return (ushort)(a >> (16 - GFBITS));
+            return (ushort)(Integers.Reverse((uint)a) >> (32 - GFBITS));
         }
     }
 }