}
/// <summary>
+ /// Reinterprets the given location as a reference to a value of type <typeparamref name="T"/>.
+ /// </summary>
+ [Intrinsic]
+ [NonVersionable]
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ public static ref T AsRef<T>(in T source)
+ {
+ throw new PlatformNotSupportedException();
+ }
+
+ /// <summary>
/// Determines the byte offset from origin to target from the given references.
/// </summary>
[Intrinsic]
[MethodImpl(MethodImplOptions.AggressiveInlining)] // 64-bit constants make the IL unusually large that makes the inliner to reject the method
public override int GetHashCode()
{
- var bits = BitConverter.DoubleToInt64Bits(m_value);
+ var bits = Unsafe.As<double, long>(ref Unsafe.AsRef(in m_value));
// Optimized check for IsNan() || IsZero()
if (((bits - 1) & 0x7FFFFFFFFFFFFFFF) >= 0x7FF0000000000000)
public override int GetHashCode()
{
- var bits = BitConverter.SingleToInt32Bits(m_value);
+ var bits = Unsafe.As<float, int>(ref Unsafe.AsRef(in m_value));
// Optimized check for IsNan() || IsZero()
if (((bits - 1) & 0x7FFFFFFF) >= 0x7F800000)