Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/5.0] Fix perf regression in IntPtr operators on 32-bit platforms #41254

Merged
merged 1 commit into from
Aug 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/libraries/System.Private.CoreLib/src/System/IntPtr.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,15 @@ public static IntPtr Add(IntPtr pointer, int offset) =>

[NonVersionable]
public static unsafe IntPtr operator +(IntPtr pointer, int offset) =>
new IntPtr((nint)pointer._value + offset);
(nint)pointer._value + offset;

[NonVersionable]
public static IntPtr Subtract(IntPtr pointer, int offset) =>
pointer - offset;

[NonVersionable]
public static unsafe IntPtr operator -(IntPtr pointer, int offset) =>
new IntPtr((nint)pointer._value - offset);
(nint)pointer._value - offset;

public static int Size
{
Expand Down
4 changes: 2 additions & 2 deletions src/libraries/System.Private.CoreLib/src/System/UIntPtr.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,15 @@ public static UIntPtr Add(UIntPtr pointer, int offset) =>

[NonVersionable]
public static unsafe UIntPtr operator +(UIntPtr pointer, int offset) =>
new UIntPtr((nuint)pointer._value + (nuint)offset);
(nuint)pointer._value + (nuint)offset;

[NonVersionable]
public static UIntPtr Subtract(UIntPtr pointer, int offset) =>
pointer - offset;

[NonVersionable]
public static unsafe UIntPtr operator -(UIntPtr pointer, int offset) =>
new UIntPtr((nuint)pointer._value - (nuint)offset);
(nuint)pointer._value - (nuint)offset;

public static int Size
{
Expand Down