Skip to content

Commit 9a1bc93

Browse files
committed
Remove unsafe modifier from Memory<T>.Span
1 parent af1b3b0 commit 9a1bc93

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/libraries/System.Private.CoreLib/src/System/Memory.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ public Memory<T> Slice(int start, int length)
263263
/// <summary>
264264
/// Returns a span from the memory.
265265
/// </summary>
266-
public unsafe Span<T> Span
266+
public Span<T> Span
267267
{
268268
[MethodImpl(MethodImplOptions.AggressiveInlining)]
269269
get
@@ -343,7 +343,7 @@ public unsafe Span<T> Span
343343
}
344344
#endif
345345

346-
refToReturn = ref Unsafe.Add(ref refToReturn, (IntPtr)(void*)desiredStartIndex);
346+
refToReturn = ref Unsafe.Add(ref refToReturn, (nint)desiredStartIndex);
347347
lengthOfUnderlyingSpan = desiredLength;
348348
}
349349

src/libraries/System.Private.CoreLib/src/System/ReadOnlyMemory.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public ReadOnlyMemory<T> Slice(int start, int length)
192192
/// <summary>
193193
/// Returns a span from the memory.
194194
/// </summary>
195-
public unsafe ReadOnlySpan<T> Span
195+
public ReadOnlySpan<T> Span
196196
{
197197
[MethodImpl(MethodImplOptions.AggressiveInlining)]
198198
get
@@ -265,7 +265,7 @@ public unsafe ReadOnlySpan<T> Span
265265
}
266266
#endif
267267

268-
refToReturn = ref Unsafe.Add(ref refToReturn, (IntPtr)(void*)desiredStartIndex);
268+
refToReturn = ref Unsafe.Add(ref refToReturn, (nint)desiredStartIndex);
269269
lengthOfUnderlyingSpan = desiredLength;
270270
}
271271

0 commit comments

Comments
 (0)