-
Notifications
You must be signed in to change notification settings - Fork 5k
Remove unsafe bool
casts
#111024
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
Remove unsafe bool
casts
#111024
Conversation
@tannergooding Is this beneficial? 2 bytes higher in code size, but 0.75 lower PerfScore. ; Assembly listing for method System.Half:op_Explicit(float):System.Half (FullOpts)
+ xor ecx, ecx
+ mov edx, -1
vucomiss xmm0, xmm0
- setp cl
- movzx rcx, cl
- dec ecx
+ cmovnp ecx, edx Related: #61761 (comment) |
src/libraries/System.Private.CoreLib/src/System/Buffers/Text/FormattingHelpers.CountDigits.cs
Show resolved
Hide resolved
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.
LGTM otherwise, thanks!. Wonder if we have more such bool <--> int unsafe conversions
These were the only conversions I found searching for:
|
Is this ready? |
@EgorBo I had a question about codegen: #111024 (comment) I'm guessing the diff codegen in that comment is preferable? |
src/libraries/System.Private.CoreLib/src/System/Buffers/Text/FormattingHelpers.CountDigits.cs
Outdated
Show resolved
Hide resolved
Tagging subscribers to this area: @dotnet/area-system-runtime |
Thanks! |
* main: Make cdac APIs public but experimental (dotnet#111180) JIT: Enable inlining for late devirtualization (dotnet#110827) Remove unsafe `bool` casts (dotnet#111024) Fix shimmed implementation of TryGetHashAndReset to handle HMAC.
Contributes to #94941.