Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace Microsoft.Extensions.Internal
#endif
static class WebEncoders
{
#if !NETCOREAPP2_1
#if !NETCOREAPP2_2 && !NETCOREAPP2_1
private const int MaxStackallocBytes = 256;
#endif
private const int MaxEncodedLength = (int.MaxValue / 4) * 3; // encode inflates the data by 4/3
Expand Down Expand Up @@ -251,7 +251,8 @@ public static unsafe string Base64UrlEncode(ReadOnlySpan<byte> data)

var base64Len = GetBufferSizeRequiredToBase64Encode(data.Length, out int numPaddingChars);
var base64UrlLen = base64Len - numPaddingChars;
#if NETCOREAPP2_1

#if NETCOREAPP2_2 || NETCOREAPP2_1
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With dotnet/sdk#1813 this could be written cleaner.

fixed (byte* ptr = &MemoryMarshal.GetReference(data))
{
return string.Create(base64UrlLen, (Ptr: (IntPtr)ptr, data.Length), (base64Url, state) =>
Expand Down