未验证 提交 0bd58320 编写于 作者: J Jan Kotas 提交者: GitHub

Delete unnecessary intrinsic attributes (#216)

These are left-over from .NET Native. Not needed for RyuJIT or Mono.
上级 d996a917
...@@ -29,14 +29,12 @@ namespace System ...@@ -29,14 +29,12 @@ namespace System
[Intrinsic] [Intrinsic]
public static readonly IntPtr Zero; public static readonly IntPtr Zero;
[Intrinsic]
[NonVersionable] [NonVersionable]
public unsafe IntPtr(int value) public unsafe IntPtr(int value)
{ {
_value = (void*)value; _value = (void*)value;
} }
[Intrinsic]
[NonVersionable] [NonVersionable]
public unsafe IntPtr(long value) public unsafe IntPtr(long value)
{ {
...@@ -48,7 +46,6 @@ public unsafe IntPtr(long value) ...@@ -48,7 +46,6 @@ public unsafe IntPtr(long value)
} }
[CLSCompliant(false)] [CLSCompliant(false)]
[Intrinsic]
[NonVersionable] [NonVersionable]
public unsafe IntPtr(void* value) public unsafe IntPtr(void* value)
{ {
...@@ -90,7 +87,6 @@ public override unsafe int GetHashCode() ...@@ -90,7 +87,6 @@ public override unsafe int GetHashCode()
#endif #endif
} }
[Intrinsic]
[NonVersionable] [NonVersionable]
public unsafe int ToInt32() public unsafe int ToInt32()
{ {
...@@ -102,34 +98,28 @@ public unsafe int ToInt32() ...@@ -102,34 +98,28 @@ public unsafe int ToInt32()
#endif #endif
} }
[Intrinsic]
[NonVersionable] [NonVersionable]
public unsafe long ToInt64() => public unsafe long ToInt64() =>
(nint)_value; (nint)_value;
[Intrinsic]
[NonVersionable] [NonVersionable]
public static unsafe explicit operator IntPtr(int value) => public static unsafe explicit operator IntPtr(int value) =>
new IntPtr(value); new IntPtr(value);
[Intrinsic]
[NonVersionable] [NonVersionable]
public static unsafe explicit operator IntPtr(long value) => public static unsafe explicit operator IntPtr(long value) =>
new IntPtr(value); new IntPtr(value);
[CLSCompliant(false)] [CLSCompliant(false)]
[Intrinsic]
[NonVersionable] [NonVersionable]
public static unsafe explicit operator IntPtr(void* value) => public static unsafe explicit operator IntPtr(void* value) =>
new IntPtr(value); new IntPtr(value);
[CLSCompliant(false)] [CLSCompliant(false)]
[Intrinsic]
[NonVersionable] [NonVersionable]
public static unsafe explicit operator void*(IntPtr value) => public static unsafe explicit operator void*(IntPtr value) =>
value._value; value._value;
[Intrinsic]
[NonVersionable] [NonVersionable]
public static unsafe explicit operator int(IntPtr value) public static unsafe explicit operator int(IntPtr value)
{ {
...@@ -141,17 +131,14 @@ public unsafe int ToInt32() ...@@ -141,17 +131,14 @@ public unsafe int ToInt32()
#endif #endif
} }
[Intrinsic]
[NonVersionable] [NonVersionable]
public static unsafe explicit operator long(IntPtr value) => public static unsafe explicit operator long(IntPtr value) =>
(nint)value._value; (nint)value._value;
[Intrinsic]
[NonVersionable] [NonVersionable]
public static unsafe bool operator ==(IntPtr value1, IntPtr value2) => public static unsafe bool operator ==(IntPtr value1, IntPtr value2) =>
value1._value == value2._value; value1._value == value2._value;
[Intrinsic]
[NonVersionable] [NonVersionable]
public static unsafe bool operator !=(IntPtr value1, IntPtr value2) => public static unsafe bool operator !=(IntPtr value1, IntPtr value2) =>
value1._value != value2._value; value1._value != value2._value;
...@@ -160,7 +147,6 @@ public unsafe int ToInt32() ...@@ -160,7 +147,6 @@ public unsafe int ToInt32()
public static IntPtr Add(IntPtr pointer, int offset) => public static IntPtr Add(IntPtr pointer, int offset) =>
pointer + offset; pointer + offset;
[Intrinsic]
[NonVersionable] [NonVersionable]
public static unsafe IntPtr operator +(IntPtr pointer, int offset) => public static unsafe IntPtr operator +(IntPtr pointer, int offset) =>
new IntPtr((nint)pointer._value + offset); new IntPtr((nint)pointer._value + offset);
...@@ -169,20 +155,17 @@ public unsafe int ToInt32() ...@@ -169,20 +155,17 @@ public unsafe int ToInt32()
public static IntPtr Subtract(IntPtr pointer, int offset) => public static IntPtr Subtract(IntPtr pointer, int offset) =>
pointer - offset; pointer - offset;
[Intrinsic]
[NonVersionable] [NonVersionable]
public static unsafe IntPtr operator -(IntPtr pointer, int offset) => public static unsafe IntPtr operator -(IntPtr pointer, int offset) =>
new IntPtr((nint)pointer._value - offset); new IntPtr((nint)pointer._value - offset);
public static int Size public static int Size
{ {
[Intrinsic]
[NonVersionable] [NonVersionable]
get => sizeof(nint); get => sizeof(nint);
} }
[CLSCompliant(false)] [CLSCompliant(false)]
[Intrinsic]
[NonVersionable] [NonVersionable]
public unsafe void* ToPointer() => _value; public unsafe void* ToPointer() => _value;
......
...@@ -26,14 +26,12 @@ namespace System ...@@ -26,14 +26,12 @@ namespace System
[Intrinsic] [Intrinsic]
public static readonly UIntPtr Zero; public static readonly UIntPtr Zero;
[Intrinsic]
[NonVersionable] [NonVersionable]
public unsafe UIntPtr(uint value) public unsafe UIntPtr(uint value)
{ {
_value = (void*)value; _value = (void*)value;
} }
[Intrinsic]
[NonVersionable] [NonVersionable]
public unsafe UIntPtr(ulong value) public unsafe UIntPtr(ulong value)
{ {
...@@ -44,7 +42,6 @@ public unsafe UIntPtr(ulong value) ...@@ -44,7 +42,6 @@ public unsafe UIntPtr(ulong value)
#endif #endif
} }
[Intrinsic]
[NonVersionable] [NonVersionable]
public unsafe UIntPtr(void* value) public unsafe UIntPtr(void* value)
{ {
...@@ -91,7 +88,6 @@ public override unsafe int GetHashCode() ...@@ -91,7 +88,6 @@ public override unsafe int GetHashCode()
#endif #endif
} }
[Intrinsic]
[NonVersionable] [NonVersionable]
public unsafe uint ToUInt32() public unsafe uint ToUInt32()
{ {
...@@ -102,31 +98,25 @@ public unsafe uint ToUInt32() ...@@ -102,31 +98,25 @@ public unsafe uint ToUInt32()
#endif #endif
} }
[Intrinsic]
[NonVersionable] [NonVersionable]
public unsafe ulong ToUInt64() => (ulong)_value; public unsafe ulong ToUInt64() => (ulong)_value;
[Intrinsic]
[NonVersionable] [NonVersionable]
public static explicit operator UIntPtr(uint value) => public static explicit operator UIntPtr(uint value) =>
new UIntPtr(value); new UIntPtr(value);
[Intrinsic]
[NonVersionable] [NonVersionable]
public static explicit operator UIntPtr(ulong value) => public static explicit operator UIntPtr(ulong value) =>
new UIntPtr(value); new UIntPtr(value);
[Intrinsic]
[NonVersionable] [NonVersionable]
public static unsafe explicit operator UIntPtr(void* value) => public static unsafe explicit operator UIntPtr(void* value) =>
new UIntPtr(value); new UIntPtr(value);
[Intrinsic]
[NonVersionable] [NonVersionable]
public static unsafe explicit operator void*(UIntPtr value) => public static unsafe explicit operator void*(UIntPtr value) =>
value._value; value._value;
[Intrinsic]
[NonVersionable] [NonVersionable]
public static unsafe explicit operator uint(UIntPtr value) => public static unsafe explicit operator uint(UIntPtr value) =>
#if BIT64 #if BIT64
...@@ -135,17 +125,14 @@ public unsafe uint ToUInt32() ...@@ -135,17 +125,14 @@ public unsafe uint ToUInt32()
(uint)value._value; (uint)value._value;
#endif #endif
[Intrinsic]
[NonVersionable] [NonVersionable]
public static unsafe explicit operator ulong(UIntPtr value) => public static unsafe explicit operator ulong(UIntPtr value) =>
(ulong)value._value; (ulong)value._value;
[Intrinsic]
[NonVersionable] [NonVersionable]
public static unsafe bool operator ==(UIntPtr value1, UIntPtr value2) => public static unsafe bool operator ==(UIntPtr value1, UIntPtr value2) =>
value1._value == value2._value; value1._value == value2._value;
[Intrinsic]
[NonVersionable] [NonVersionable]
public static unsafe bool operator !=(UIntPtr value1, UIntPtr value2) => public static unsafe bool operator !=(UIntPtr value1, UIntPtr value2) =>
value1._value != value2._value; value1._value != value2._value;
...@@ -154,7 +141,6 @@ public unsafe uint ToUInt32() ...@@ -154,7 +141,6 @@ public unsafe uint ToUInt32()
public static UIntPtr Add(UIntPtr pointer, int offset) => public static UIntPtr Add(UIntPtr pointer, int offset) =>
pointer + offset; pointer + offset;
[Intrinsic]
[NonVersionable] [NonVersionable]
public static unsafe UIntPtr operator +(UIntPtr pointer, int offset) => public static unsafe UIntPtr operator +(UIntPtr pointer, int offset) =>
new UIntPtr((nuint)pointer._value + (nuint)offset); new UIntPtr((nuint)pointer._value + (nuint)offset);
...@@ -163,19 +149,16 @@ public unsafe uint ToUInt32() ...@@ -163,19 +149,16 @@ public unsafe uint ToUInt32()
public static UIntPtr Subtract(UIntPtr pointer, int offset) => public static UIntPtr Subtract(UIntPtr pointer, int offset) =>
pointer - offset; pointer - offset;
[Intrinsic]
[NonVersionable] [NonVersionable]
public static unsafe UIntPtr operator -(UIntPtr pointer, int offset) => public static unsafe UIntPtr operator -(UIntPtr pointer, int offset) =>
new UIntPtr((nuint)pointer._value - (nuint)offset); new UIntPtr((nuint)pointer._value - (nuint)offset);
public static int Size public static int Size
{ {
[Intrinsic]
[NonVersionable] [NonVersionable]
get => sizeof(nuint); get => sizeof(nuint);
} }
[Intrinsic]
[NonVersionable] [NonVersionable]
public unsafe void* ToPointer() => _value; public unsafe void* ToPointer() => _value;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册