Add polyfills for System.Numerics.BitOperations - #137
Merged
Conversation
Copilot created this pull request from a session on behalf of
Tyrrrz
August 2, 2026 20:32
View session
Tyrrrz
marked this pull request as ready for review
August 2, 2026 21:04
Tyrrrz
reviewed
Aug 2, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## prime #137 +/- ##
==========================================
+ Coverage 99.17% 99.20% +0.03%
==========================================
Files 150 154 +4
Lines 4005 4170 +165
Branches 88 89 +1
==========================================
+ Hits 3972 4137 +165
Misses 13 13
Partials 20 20 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Tyrrrz
approved these changes
Aug 2, 2026
Owner
|
@copilot please merge latest |
…fills-for-bitoperations # Conflicts: # Signatures.md
Contributor
Author
This was referenced Sep 1, 2026
This was referenced Sep 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BitOperationshad no polyfill coverage. Its members were introduced across four different .NET versions, so a single guard wasn't enough — the type itself doesn't exist before .NET Core 3.0, with individual members added later.Version breakdown
PolyShim/NetCore30/BitOperations.cs— defines the full type (PopCount,LeadingZeroCount,Log2,TrailingZeroCount,RotateLeft,RotateRight) for targets that predate .NET Core 3.0, sinceBitOperationsisn't part ofnetstandardat any version either.PolyShim/Net60/BitOperations.cs— addsIsPow2andRoundUpToPowerOf2via extension members.PolyShim/Net70/BitOperations.cs— addsIntPtr/UIntPtroverloads of the above, matching the nativenint/nuintoverloads added that version.PolyShim/Net80/BitOperations.cs— adds theCrc32Coverloads.Each file is guarded to only compile in when the corresponding native members aren't already available, following the same "define type, then extend via later directories" pattern already used for
RandomNumberGenerator.Other changes
BitOperationsTests.csunder the four correspondingPolyShim.Testsdirectories.Signatures.mdto include the new type and members.