-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Use C# compiler provided nint/nuint #36159
Conversation
src/libraries/System.Private.CoreLib/src/System/Text/Unicode/Utf16Utility.Validation.cs
Show resolved
Hide resolved
Is it safe to use |
Yes, the tests caught it too |
Just to confirm, it should not be a breaking change if in the future we decide to change APIs like |
Does it make |
Corelib still has other ifdefs and compilation switches for endianness and ARM/ARM64 vs x86/x64 intrinsics at the very least |
It also uses it for some of the memory copy/set methods and the IntPtr/UIntPtr implementations |
It would not be a binary breaking change. I suspect that it may be a source breaking change in some rare cases. |
@@ -133,7 +119,7 @@ public int CompareTo(Utf8String? other, StringComparison comparison) | |||
#if SYSTEM_PRIVATE_CORELIB | |||
return ref Unsafe.AddByteOffset(ref DangerousGetMutableReference(), index); | |||
#else | |||
return ref Unsafe.AddByteOffset(ref DangerousGetMutableReference(), (IntPtr)index); | |||
return ref Unsafe.AddByteOffset(ref DangerousGetMutableReference(), (nint)index); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the whole #if can be removed here now. I can do that in a follow up.
Would changing a return value or |
Seems like a good example of the possible source breaking changes Jan alluded to. But you'd have to retarget + recompile your app to see the breaks. The |
wouldn't changing an |
No description provided.