summary refs log tree commit diff
path: root/crypto/src/util/Arrays.cs
diff options
context:
space:
mode:
authorPeter Dettman <peter.dettman@bouncycastle.org>2023-04-11 18:55:01 +0700
committerPeter Dettman <peter.dettman@bouncycastle.org>2023-04-11 18:55:01 +0700
commit767f1c498d07d59c1f98940c0e45db9206a33c30 (patch)
tree1bbf95c542d4f12e8b648dd3e770236dd44de94d /crypto/src/util/Arrays.cs
parentReduce allocations in hex encoding (diff)
downloadBouncyCastle.NET-ed25519-767f1c498d07d59c1f98940c0e45db9206a33c30.tar.xz
Support BitString construction from ReadOnlySpan
Diffstat (limited to 'crypto/src/util/Arrays.cs')
-rw-r--r--crypto/src/util/Arrays.cs7
1 files changed, 7 insertions, 0 deletions
diff --git a/crypto/src/util/Arrays.cs b/crypto/src/util/Arrays.cs
index da74d467a..83fafb388 100644
--- a/crypto/src/util/Arrays.cs
+++ b/crypto/src/util/Arrays.cs
@@ -1037,6 +1037,13 @@ namespace Org.BouncyCastle.Utilities
             return rv;
         }
 
+        public static T[] Prepend<T>(ReadOnlySpan<T> a, T b)
+        {
+            T[] result = new T[1 + a.Length];
+            result[0] = b;
+            a.CopyTo(result.AsSpan(1));
+            return result;
+        }
 #endif
     }
 }