diff --git a/src/DotNext/Runtime/Intrinsics.cs b/src/DotNext/Runtime/Intrinsics.cs index 2560cc314..a3b27ed1d 100644 --- a/src/DotNext/Runtime/Intrinsics.cs +++ b/src/DotNext/Runtime/Intrinsics.cs @@ -110,12 +110,8 @@ public static unsafe int PointerHashCode([In] void* pointer) /// The object whose address is obtained. /// An address of the given object. [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static nint AddressOf(ref readonly T value) - { - PushInRef(in value); - Conv_I(); - return Return(); - } + public static unsafe nint AddressOf(ref readonly T value) + => (nint)Unsafe.AsPointer(ref Unsafe.AsRef(in value)); /// /// Converts typed reference into managed pointer. @@ -340,16 +336,6 @@ public static nuint GetLength(this Array array) return Return(); } - [MethodImpl(MethodImplOptions.AggressiveInlining)] - internal static Span ReinterpretCast(Span input) - where TInput : unmanaged - where TOutput : unmanaged - { - Debug.Assert(Unsafe.SizeOf() == Unsafe.SizeOf()); - - return MemoryMarshal.CreateSpan(ref Unsafe.As(ref MemoryMarshal.GetReference(input)), input.Length); - } - [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static ReadOnlySpan ReinterpretCast(ReadOnlySpan input) where TInput : unmanaged