Skip to content
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

Simplify AsnDecoder.ReverseBitsPerByte #75301

Merged
merged 1 commit into from
Sep 9, 2022
Merged

Conversation

stephentoub
Copy link
Member

Using the same bit twiddling hack as

private static byte ReverseBitOrder(byte b)
{
return (byte)(unchecked(b * 0x0202020202ul & 0x010884422010ul) % 1023);
}
}

@ghost
Copy link

ghost commented Sep 8, 2022

Tagging subscribers to this area: @dotnet/area-system-security, @vcsjones
See info in area-owners.md if you want to be subscribed.

Issue Details

Using the same bit twiddling hack as

private static byte ReverseBitOrder(byte b)
{
return (byte)(unchecked(b * 0x0202020202ul & 0x010884422010ul) % 1023);
}
}

Author: stephentoub
Assignees: stephentoub
Labels:

area-System.Security

Milestone: -

@ghost
Copy link

ghost commented Sep 9, 2022

Tagging subscribers to this area: @dotnet/area-system-formats-asn1, @vcsjones
See info in area-owners.md if you want to be subscribed.

Issue Details

Using the same bit twiddling hack as

private static byte ReverseBitOrder(byte b)
{
return (byte)(unchecked(b * 0x0202020202ul & 0x010884422010ul) % 1023);
}
}

Author: stephentoub
Assignees: stephentoub
Labels:

area-System.Formats.Asn1

Milestone: -

Copy link
Member

@danmoseley danmoseley left a comment

Choose a reason for hiding this comment

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

I guess not common enough for a public method

@stephentoub
Copy link
Member Author

Failure is #75329

@stephentoub stephentoub merged commit e380cab into dotnet:main Sep 9, 2022
@stephentoub stephentoub deleted the asnbits branch September 9, 2022 13:25
@stephentoub
Copy link
Member Author

stephentoub commented Sep 9, 2022

I guess not common enough for a public method

I wouldn't be adverse to a:

public static class BitOperations
{
+    public static byte ReverseBits(byte value);
}

but I don't know it's valuable enough to be warranted.

@ghost ghost locked as resolved and limited conversation to collaborators Oct 9, 2022
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.

3 participants