Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

huoyaoyuan
Copy link
Member

Closes #43135

A special fast path for operating 32bit number on 64bit platform, which should be most common.

@ghost
Copy link

ghost commented Jun 10, 2021

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@ghost
Copy link

ghost commented Jun 10, 2021

Tagging subscribers to this area: @tannergooding, @pgovind
See info in area-owners.md if you want to be subscribed.

Issue Details

Closes #43135

A special fast path for operating 32bit number on 64bit platform, which should be most common.

Author: huoyaoyuan
Assignees: -
Labels:

area-System.Numerics, new-api-needs-documentation

Milestone: -

[InlineData(2u, 2u)]
[InlineData(0x7FFF_FFFFu, 0x8000_0000u)]
[InlineData(0x8000_0000u, 0x8000_0000u)]
[InlineData(0xFFFF_FFFFu, 0)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also add a test for 8000_0001? and a couple values between 2 and int.MaxValue?

Just a couple random values rather than explicitly just the edge cases would be useful I think

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got them literally using Random

@stephentoub
Copy link
Member

Can you replace


and
private static int RoundUpToPowerOf2(int i)

with use of the new API?

@huoyaoyuan
Copy link
Member Author

Done

Copy link
Member

@stephentoub stephentoub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

@tannergooding
Copy link
Member

/azp run runtime-coreclr jitstress-isas-x86, runtime-coreclr jitstress-isas-arm

@tannergooding
Copy link
Member

I've kicked off the outerloop ISA jobs to ensure the software fallback is tested. It should be good to merge once those complete.

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@ghost
Copy link

ghost commented Jun 11, 2021

Hello @tannergooding!

Because this pull request has the auto-merge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit ffcef4a into dotnet:main Jun 11, 2021
@huoyaoyuan huoyaoyuan deleted the roundup branch June 12, 2021 05:49
@ghost ghost locked as resolved and limited conversation to collaborators Jul 12, 2021
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Expose RoundUpToPowerOf2 from BitOperations and optimize it
3 participants