diff options
Diffstat (limited to '')
-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 |