-
Notifications
You must be signed in to change notification settings - Fork 5.1k
[API Implementation]: Expose general purpose Crc32 APIs #61558
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
Changes from all commits
Commits
Show all changes
60 commits
Select commit
Hold shift + click to select a range
66d11bb
Expose Crc32 Implementation and implement Crc32 software fallback
deeprobin d33918c
Fix signature of BitOperation Crc32 methods
deeprobin b8eb138
Implement common test cases
deeprobin f22c90d
Add X64 Intrinsic support for Crc32(uint crc, ulong data)
deeprobin 3b0313c
Add documentation comments
deeprobin ece5c27
Remove Hwintrinsic doc-comment
deeprobin 1474bab
Rename Crc32 to Crc32C
deeprobin a362cf9
Remove unnessecary heap allocation
deeprobin c42411b
Fix software fallback using table-based-CRC
deeprobin edff837
Usage of uint32_t __crc32ch (uint32_t a, uint32_t b)
deeprobin 7ed1a09
Remove Crc.Sse42 implementation for Crc32C(uint crc, ulong data)
deeprobin 56953c9
Add SSE 4.2 x64 implementation with byte truncation for Crc32C(uint c…
deeprobin e171227
Replace Unsafe.As with unchecked-uint cast
deeprobin bf95530
Usage of WriteUnaligned instead of As
deeprobin 4b91869
Usage of WriteUnaligned instead of As
deeprobin 1ef8591
Usage of WriteUnaligned instead of As
deeprobin b369a75
Usage of explicit types
deeprobin 8b3afd2
Merge branch 'issue-2036' of https://github.com/deeprobin/runtime int…
deeprobin ca96fdf
Fix Software-Fallback Table to Castalogni equivalent
deeprobin 3ba6819
Fix test signature
deeprobin ca35eaa
Remove mask for software fallback
deeprobin d74d96a
reuse reflected table generator
kasperk81 5bb5943
Fix test data
deeprobin d44a215
Usage of CRC Table Generator instead of constant values
deeprobin 1e7a753
Fix solution file
deeprobin 43704ec
Revert "Usage of CRC Table Generator instead of constant values"
deeprobin 7e61dda
Merge pull request #1 from kasperk81/issue-2036
deeprobin d7f2156
Fix solution file
deeprobin e5d5563
Merge branch 'issue-2036' of https://github.com/deeprobin/runtime int…
deeprobin ee294c9
Make Crc32ReflectedTable static
deeprobin db9d590
Fix wrong intrinsic for Arm64/BitOperations.Crc32C(uint crc, ulong data)
deeprobin a125263
Merge branch 'issue-2036' of https://github.com/deeprobin/runtime int…
deeprobin 385f528
Reduce amount of stackalloc statements and replace them with MemoryMa…
deeprobin 4f8da5d
Loop unwinding and performance optimization
deeprobin 6911e7d
Merge branch 'dotnet:main' into issue-2036
deeprobin 6023bcd
Remove unnessecary cast
deeprobin d22566c
Use MemoryMarshal.GetArrayDataReference instead of direct array access
deeprobin 0e4467f
Remove unnessecary newlines
deeprobin eea2874
Merge branch 'issue-2036' of https://github.com/deeprobin/runtime int…
deeprobin dfd7ed7
Merge branch 'dotnet:main' into issue-2036
deeprobin 02319ea
Update src/libraries/System.Private.CoreLib/src/System/Numerics/BitOp…
deeprobin c5bc276
Add x64 SSE check
deeprobin cf974b1
Move Crc32 Software into own class
deeprobin 5801d6e
Fix merge conflict
deeprobin c4092f2
Remove IsSupported check
deeprobin 6b7e6c4
Fix parameter naming
deeprobin de1efd9
Fix fallback implementation method naming
deeprobin c0da910
Improve documentation
deeprobin 2720d18
Move bswap into Crc32Fallback class
deeprobin 0cee4ff
Implement efficient usage of SSE x86/x64
deeprobin ec74c04
Style Changes for BitOperations.cs
deeprobin 12d7a1c
Remove unnessecary `bswap` of a single byte
deeprobin c8f5d7d
Merge branch 'main' into issue-2036
deeprobin ef65ff1
Merge branch 'main' into issue-2036
deeprobin f007128
Fix doc comments
deeprobin 0057d5e
fix doc
deeprobin c6a69be
Fix
deeprobin 230e5cc
Merge remote-tracking branch 'upstream/main' into issue-2036
deeprobin f60964b
Merge remote-tracking branch 'upstream/main' into issue-2036
deeprobin 59fa0e2
Apply suggestions
deeprobin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
src/libraries/Common/src/System/Numerics/Crc32ReflectedTable.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace System.Numerics | ||
{ | ||
internal static class Crc32ReflectedTable | ||
{ | ||
internal static uint[] Generate(uint reflectedPolynomial) | ||
{ | ||
uint[] table = new uint[256]; | ||
|
||
for (int i = 0; i < 256; i++) | ||
{ | ||
uint val = (uint)i; | ||
|
||
for (int j = 0; j < 8; j++) | ||
{ | ||
if ((val & 0b0000_0001) == 0) | ||
{ | ||
val >>= 1; | ||
} | ||
else | ||
{ | ||
val = (val >> 1) ^ reflectedPolynomial; | ||
} | ||
} | ||
|
||
table[i] = val; | ||
} | ||
|
||
return table; | ||
} | ||
} | ||
} |
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
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
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
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
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.