diff options
author | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-08-31 01:48:36 +0700 |
---|---|---|
committer | Peter Dettman <peter.dettman@bouncycastle.org> | 2022-08-31 01:48:36 +0700 |
commit | f01393e0ce47b124d711e7c3512bd2fab50e98bf (patch) | |
tree | cd27c8543ef6a99b43af92dc710485481c2a0f08 /crypto/src/util/Spans.cs | |
parent | Fix exceptions (diff) | |
download | BouncyCastle.NET-ed25519-f01393e0ce47b124d711e7c3512bd2fab50e98bf.tar.xz |
Span-based variants for IAeadCipher.ProcessByte(s)
Diffstat (limited to 'crypto/src/util/Spans.cs')
-rw-r--r-- | crypto/src/util/Spans.cs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/crypto/src/util/Spans.cs b/crypto/src/util/Spans.cs new file mode 100644 index 000000000..5e1b3737c --- /dev/null +++ b/crypto/src/util/Spans.cs @@ -0,0 +1,18 @@ +#if NETCOREAPP2_1_OR_GREATER || NETSTANDARD2_1_OR_GREATER +using System; +using System.Runtime.CompilerServices; + +#nullable enable + +namespace Org.BouncyCastle.Utilities +{ + internal static class Spans + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + internal static Span<T> FromNullable<T>(T[]? array, int start) + { + return array == null ? Span<T>.Empty : array.AsSpan(start); + } + } +} +#endif |