summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2023-04-30 19:13:29 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2023-04-30 19:13:29 +0700
commit5d6ec7d9dbb486cb51cc7d98cbdfcad7fb97bbf1 (patch)
tree7b7b53a692a9ec1dadc4c221dc20d04f677d6032
parentUse Bytes methods in a few places (diff)
downloadBouncyCastle.NET-ed25519-5d6ec7d9dbb486cb51cc7d98cbdfcad7fb97bbf1.tar.xz
Use Longs.NumberOfTrailingZeros
-rw-r--r--crypto/src/crypto/modes/OCBBlockCipher.cs14
1 files changed, 1 insertions, 13 deletions
diff --git a/crypto/src/crypto/modes/OCBBlockCipher.cs b/crypto/src/crypto/modes/OCBBlockCipher.cs
index 604a7d205..a7facaa04 100644
--- a/crypto/src/crypto/modes/OCBBlockCipher.cs
+++ b/crypto/src/crypto/modes/OCBBlockCipher.cs
@@ -732,19 +732,7 @@ namespace Org.BouncyCastle.Crypto.Modes
 
         protected static int OCB_ntz(long x)
         {
-            if (x == 0)
-            {
-                return 64;
-            }
-
-            int n = 0;
-            ulong ux = (ulong)x;
-            while ((ux & 1UL) == 0UL)
-            {
-                ++n;
-                ux >>= 1;
-            }
-            return n;
+            return Longs.NumberOfTrailingZeros(x);
         }
 
         protected static int ShiftLeft(byte[] block, byte[] output)