File tree Expand file tree Collapse file tree 2 files changed +4
-12
lines changed
Microsoft.Toolkit.HighPerformance/Extensions Expand file tree Collapse file tree 2 files changed +4
-12
lines changed Original file line number Diff line number Diff line change @@ -197,7 +197,6 @@ public static ReadOnlySpan<byte> AsBytes<T>(this ReadOnlySpan<T> span)
197197
198198 /// <summary>
199199 /// Casts a <see cref="ReadOnlySpan{T}"/> of one primitive type <typeparamref name="TFrom"/> to another primitive type <typeparamref name="TTo"/>.
200- /// These types may not contain pointers or references. This is checked at runtime in order to preserve type safety.
201200 /// </summary>
202201 /// <typeparam name="TFrom">The type of items in the source <see cref="ReadOnlySpan{T}"/>.</typeparam>
203202 /// <typeparam name="TTo">The type of items in the destination <see cref="ReadOnlySpan{T}"/>.</typeparam>
@@ -206,14 +205,11 @@ public static ReadOnlySpan<byte> AsBytes<T>(this ReadOnlySpan<T> span)
206205 /// <remarks>
207206 /// Supported only for platforms that support misaligned memory access or when the memory block is aligned by other means.
208207 /// </remarks>
209- /// <exception cref="ArgumentException">
210- /// Thrown when <typeparamref name="TFrom"/> or <typeparamref name="TTo"/> contains pointers.
211- /// </exception>
212208 [ Pure ]
213209 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
214210 public static ReadOnlySpan < TTo > Cast < TFrom , TTo > ( this ReadOnlySpan < TFrom > span )
215- where TFrom : struct
216- where TTo : struct
211+ where TFrom : unmanaged
212+ where TTo : unmanaged
217213 {
218214 return MemoryMarshal . Cast < TFrom , TTo > ( span ) ;
219215 }
Original file line number Diff line number Diff line change @@ -71,7 +71,6 @@ public static Span<byte> AsBytes<T>(this Span<T> span)
7171
7272 /// <summary>
7373 /// Casts a <see cref="Span{T}"/> of one primitive type <typeparamref name="TFrom"/> to another primitive type <typeparamref name="TTo"/>.
74- /// These types may not contain pointers or references. This is checked at runtime in order to preserve type safety.
7574 /// </summary>
7675 /// <typeparam name="TFrom">The type of items in the source <see cref="Span{T}"/>.</typeparam>
7776 /// <typeparam name="TTo">The type of items in the destination <see cref="Span{T}"/>.</typeparam>
@@ -80,14 +79,11 @@ public static Span<byte> AsBytes<T>(this Span<T> span)
8079 /// <remarks>
8180 /// Supported only for platforms that support misaligned memory access or when the memory block is aligned by other means.
8281 /// </remarks>
83- /// <exception cref="ArgumentException">
84- /// Thrown when <typeparamref name="TFrom"/> or <typeparamref name="TTo"/> contains pointers.
85- /// </exception>
8682 [ Pure ]
8783 [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
8884 public static Span < TTo > Cast < TFrom , TTo > ( this Span < TFrom > span )
89- where TFrom : struct
90- where TTo : struct
85+ where TFrom : unmanaged
86+ where TTo : unmanaged
9187 {
9288 return MemoryMarshal . Cast < TFrom , TTo > ( span ) ;
9389 }
You can’t perform that action at this time.
0 commit comments