Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DangerousGetReferenceAtメソッドを削除 #84

Merged
merged 1 commit into from
Nov 6, 2021
Merged
Changes from all commits
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
10 changes: 1 addition & 9 deletions Source/Utf8Utility/Utf8Array.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public ReadOnlySpan<byte> AsSpan(int start)
// 引数の検証をスキップするために、手動でReadOnlySpanを作成する。
#if NET6_0_OR_GREATER
var length = _value.Length - start;
ref var valueStart = ref DangerousGetReferenceAt(start);
ref var valueStart = ref Unsafe.AddByteOffset(ref DangerousGetReference(), (nint)(uint)length);
return MemoryMarshal.CreateReadOnlySpan(ref valueStart, length);
#else
var span = new ReadOnlySpan<byte>(_value, start, _value.Length - start);
Expand Down Expand Up @@ -341,14 +341,6 @@ public bool IsEmptyOrWhiteSpace()
/// <returns>最初の要素への参照</returns>
public ref byte DangerousGetReference() => ref _value.DangerousGetReference();

/// <summary>
/// 指定された要素への参照を取得します。
/// このメソッドは境界チェックを行いません。
/// </summary>
/// <param name="index">インデックス</param>
/// <returns>指定された要素への参照</returns>
public ref byte DangerousGetReferenceAt(int index) => ref _value.DangerousGetReferenceAt(index);

/// <summary>
/// <see cref="Utf8Array"/>構造体の新しいインスタンスを取得します。
/// このメソッドは引数チェックを行いません。
Expand Down