diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-10-05 15:44:48 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-10-05 15:44:48 +0700 |
commit | 7699428eb4416a52ae9a529c133839b2fd989903 (patch) | |
tree | 64bf393583c98549253b5edd6c67695d70c8f091 /crypto/src/util/Arrays.cs | |
parent | BigInteger in-place conversions (diff) | |
download | BouncyCastle.NET-ed25519-7699428eb4416a52ae9a529c133839b2fd989903.tar.xz |
Various span usages
Diffstat (limited to '')
-rw-r--r-- | crypto/src/util/Arrays.cs | 18 |
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]; |