From f01393e0ce47b124d711e7c3512bd2fab50e98bf Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Wed, 31 Aug 2022 01:48:36 +0700 Subject: Span-based variants for IAeadCipher.ProcessByte(s) --- crypto/src/util/Spans.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 crypto/src/util/Spans.cs (limited to 'crypto/src/util') 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 FromNullable(T[]? array, int start) + { + return array == null ? Span.Empty : array.AsSpan(start); + } + } +} +#endif -- cgit 1.4.1