Rename package to ComputeSharp.D2D1
Also rename D2D1 to D2D for consistency with HLSL, and tweak namespaces
このコミットが含まれているのは:
1 親
d4501323d7
コミット
5390d8b27c
104ファイル変更
+274
-273
検索条件に一致するファイルはありません
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace ComputeSharp.D2D1.NetStandard.System.Text;
|
||||
|
||||
/// <summary>
|
||||
/// A polyfill type that mirrors some methods from <see cref="Encoding"/> on .NET 5.
|
||||
/// </summary>
|
||||
internal static class EncodingExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Encodes into a span of bytes a set of characters from the specified read-only span.
|
||||
/// </summary>
|
||||
/// <param name="encoding">The input <see cref="Encoding"/> instance to use.</param>
|
||||
/// <param name="chars">The span containing the set of characters to encode.</param>
|
||||
/// <param name="bytes">The byte span to hold the encoded bytes.</param>
|
||||
/// <returns>The number of encoded bytes.</returns>
|
||||
public static unsafe int GetBytes(this Encoding encoding, ReadOnlySpan<char> chars, Span<byte> bytes)
|
||||
{
|
||||
fixed (char* charsPtr = &MemoryMarshal.GetReference(chars))
|
||||
fixed (byte* bytesPtr = &MemoryMarshal.GetReference(bytes))
|
||||
{
|
||||
return encoding.GetBytes(charsPtr, chars.Length, bytesPtr, bytes.Length);
|
||||
}
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする