Skip to content

Cleanup BitMapper sizeof type #86881

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

Merged
merged 1 commit into from
May 31, 2023
Merged

Cleanup BitMapper sizeof type #86881

merged 1 commit into from
May 31, 2023

Conversation

IDisposable
Copy link
Contributor

@IDisposable IDisposable commented May 30, 2023

In fix for #86740, the newly introduced internal BitMapper in DiagnosticsHelper.cs uses an internal Span<ulong> however a couple of sizeof() used long. While these types are the same size, this is a minor correctness/cleanliness change with no actual code delta. Also added a comment to document the right-shift by 6 bits.

The newly introduced internal BitMapper in DiagnosticsHelper uses an internal `Span<ulong>` however a couple of `sizeof()` used `long`. While these types are the same size, this is a minor correctness/cleanliness change with no actual code delta.
Also added a comment to document the right-shift by 6 bits.
@ghost ghost added needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners community-contribution Indicates that the PR has been added by a community member labels May 30, 2023
@IDisposable
Copy link
Contributor Author

IDisposable commented May 30, 2023

Wondering if we care about TARGET_64BIT building (e.g. should we be using ulong for 64-bit builds and uint for 32-bit builds). This is something we do care about in BitOperations.PopCount for example.

@vcsjones vcsjones added area-System.Diagnostics and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels May 30, 2023
@ghost
Copy link

ghost commented May 30, 2023

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

Issue Details

In fix for #86740, the newly introduced internal BitMapper in DiagnosticsHelper.cs uses an internal Span<ulong> however a couple of sizeof() used long. While these types are the same size, this is a minor correctness/cleanliness change with no actual code delta. Also added a comment to document the right-shift by 6 bits.

Author: IDisposable
Assignees: -
Labels:

area-System.Diagnostics, community-contribution, needs-area-label

Milestone: -

@IDisposable
Copy link
Contributor Author

IDisposable commented May 30, 2023

Additionally, wondering if there is value in making this a System.Collection publicly visible class (can a public "class" even be a struct?)

@IDisposable
Copy link
Contributor Author

Comments @noahfalk or @tarekgh?

@noahfalk
Copy link
Member

Wondering if we care about TARGET_64BIT building

Performance differences are possible, but functionally it shouldn't matter.

Additionally, wondering if there is value in making this a System.Collection publicly visible class

Given that we already have BitArray and BitVector32, I'm skeptical there are many .NET users who would benefit from another. I don't rule it out, but also no plan to proactively pursue it.

(can a public "class" even be a struct?)

Assuming that you used 'public class' to mean any public type in .NET then sure, BitVector32 is an example that is struct and there are many public structs in .NET. If you meant 'class' as in the C# keyword, then no, struct and class are mutually exclusive.

Copy link
Member

@noahfalk noahfalk left a comment

Choose a reason for hiding this comment

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

Seems fine to me, but @tarekgh owns the code so his call if he wants the change.

@tarekgh tarekgh merged commit 7006a65 into dotnet:main May 31, 2023
@IDisposable IDisposable deleted the cleanup-type branch May 31, 2023 16:51
@ghost ghost locked as resolved and limited conversation to collaborators Jun 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-System.Diagnostics community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants