summary refs log tree commit diff
path: root/crypto/src/util
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2022-10-05 15:44:48 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2022-10-05 15:44:48 +0700
commit7699428eb4416a52ae9a529c133839b2fd989903 (patch)
tree64bf393583c98549253b5edd6c67695d70c8f091 /crypto/src/util
parentBigInteger in-place conversions (diff)
downloadBouncyCastle.NET-ed25519-7699428eb4416a52ae9a529c133839b2fd989903.tar.xz
Various span usages
Diffstat (limited to 'crypto/src/util')
-rw-r--r--crypto/src/util/Arrays.cs18
1 files changed, 18 insertions, 0 deletions
diff --git a/crypto/src/util/Arrays.cs b/crypto/src/util/Arrays.cs
index c2ba9c3e1..e8dd02148 100644
--- a/crypto/src/util/Arrays.cs
+++ b/crypto/src/util/Arrays.cs
@@ -620,6 +620,24 @@ namespace Org.BouncyCastle.Utilities
             }
         }
 
+        public static void Fill<T>(T[] ts, T t)
+        {
+            for (int i = 0; i < ts.Length; ++i)
+            {
+                ts[i] = t;
+            }
+        }
+
+#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER
+        public static void Fill<T>(Span<T> ts, T t)
+        {
+            for (int i = 0; i < ts.Length; ++i)
+            {
+                ts[i] = t;
+            }
+        }
+#endif
+
         public static byte[] CopyOf(byte[] data, int newLength)
         {
             byte[] tmp = new byte[newLength];