Skip to content

Commit f488388

Browse files
committed
Update Enum.EnumInfo
1 parent 29b55bd commit f488388

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/libraries/System.Private.CoreLib/src/System/Enum.EnumInfo.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System.Diagnostics;
55
using System.Numerics;
6+
using System.Runtime.CompilerServices;
67
using System.Runtime.InteropServices;
78

89
namespace System
@@ -36,7 +37,7 @@ public EnumInfo(bool hasFlagsAttribute, TStorage[] values, string[] names)
3637
public unsafe TResult[] CloneValues<TResult>() where TResult : struct
3738
{
3839
Debug.Assert(sizeof(TStorage) == sizeof(TResult));
39-
return MemoryMarshal.Cast<TStorage, TResult>(Values).ToArray();
40+
return Unsafe.BitCast<ReadOnlySpan<TStorage>, ReadOnlySpan<TResult>>(Values).ToArray();
4041
}
4142
}
4243
}

0 commit comments

Comments
 (0)