|
|
@ -211,6 +211,11 @@ namespace System.Runtime.CompilerServices |
|
|
|
return Unsafe.AsPointer(ref value); |
|
|
|
return Unsafe.AsPointer(ref value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
|
|
|
|
public static void SkipInit<T>(out T value) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
public unsafe static int SizeOf<T>() |
|
|
|
public unsafe static int SizeOf<T>() |
|
|
|
{ |
|
|
|
{ |
|
|
@ -321,12 +326,24 @@ namespace System.Runtime.CompilerServices |
|
|
|
return ref Unsafe.Add(ref source, elementOffset); |
|
|
|
return ref Unsafe.Add(ref source, elementOffset); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
|
|
|
|
public static ref T Add<T>(ref T source, UIntPtr elementOffset) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return ref Unsafe.Add(ref source, elementOffset); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
public static ref T AddByteOffset<T>(ref T source, IntPtr byteOffset) |
|
|
|
public static ref T AddByteOffset<T>(ref T source, IntPtr byteOffset) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return ref Unsafe.AddByteOffset(ref source, byteOffset); |
|
|
|
return ref Unsafe.AddByteOffset(ref source, byteOffset); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
|
|
|
|
public static ref T AddByteOffset<T>(ref T source, UIntPtr byteOffset) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return ref Unsafe.AddByteOffset(ref source, byteOffset); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
public static ref T Subtract<T>(ref T source, int elementOffset) |
|
|
|
public static ref T Subtract<T>(ref T source, int elementOffset) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -345,12 +362,24 @@ namespace System.Runtime.CompilerServices |
|
|
|
return ref Unsafe.Subtract(ref source, elementOffset); |
|
|
|
return ref Unsafe.Subtract(ref source, elementOffset); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
|
|
|
|
public static ref T Subtract<T>(ref T source, UIntPtr elementOffset) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return ref Unsafe.Subtract(ref source, elementOffset); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
public static ref T SubtractByteOffset<T>(ref T source, IntPtr byteOffset) |
|
|
|
public static ref T SubtractByteOffset<T>(ref T source, IntPtr byteOffset) |
|
|
|
{ |
|
|
|
{ |
|
|
|
return ref Unsafe.SubtractByteOffset(ref source, byteOffset); |
|
|
|
return ref Unsafe.SubtractByteOffset(ref source, byteOffset); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
|
|
|
|
public static ref T SubtractByteOffset<T>(ref T source, UIntPtr byteOffset) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return ref Unsafe.SubtractByteOffset(ref source, byteOffset); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
public static IntPtr ByteOffset<T>(ref T origin, ref T target) |
|
|
|
public static IntPtr ByteOffset<T>(ref T origin, ref T target) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -374,5 +403,17 @@ namespace System.Runtime.CompilerServices |
|
|
|
{ |
|
|
|
{ |
|
|
|
return (ref left) < (ref right); |
|
|
|
return (ref left) < (ref right); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
|
|
|
|
public unsafe static bool IsNullRef<T>(ref T source) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return Unsafe.AsPointer(ref source) == null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[MethodImpl(MethodImplOptions.AggressiveInlining)] |
|
|
|
|
|
|
|
public unsafe static ref T NullRef<T>() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return ref *(T*)null; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|