File tree Expand file tree Collapse file tree
src/Reloaded.Memory/Internals/Algorithms Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,12 +40,10 @@ internal static unsafe nuint GetHashCodeUnstable(this ReadOnlySpan<char> text)
4040 // For our use of hashing file paths, this is okay, as files with different names but same extension
4141 // would still hash differently. If I were to PR this to runtime though, this would need fixing.
4242
43- // Over 4 Vec256 regs (32 * 4 = 128 bytes)
44- if ( Vector256 . IsHardwareAccelerated && length >= ( sizeof ( Vector256 < ulong > ) / sizeof ( char ) ) * 4 )
43+ if ( Vector256 . IsHardwareAccelerated && length >= sizeof ( nuint ) * 8 )
4544 return text . UnstableHashVec256 ( ) ;
4645
47- // Over 4 Vec128 regs (16 * 4 = 64 bytes)
48- if ( Vector128 . IsHardwareAccelerated && length >= ( sizeof ( Vector128 < ulong > ) / sizeof ( char ) ) * 4 )
46+ if ( Vector128 . IsHardwareAccelerated && length >= sizeof ( nuint ) * 4 )
4947 return text . UnstableHashVec128 ( ) ;
5048#endif
5149
Original file line number Diff line number Diff line change @@ -35,21 +35,15 @@ internal static unsafe nuint GetHashCodeUnstableLower(this ReadOnlySpan<char> te
3535 {
3636#if NET7_0_OR_GREATER
3737 var length = text . Length ; // Span has no guarantee of null terminator.
38- // For short strings below size of nuint, we need separate approach; so we use legacy runtime approach
39- // for said cold case.
40-
41- // Note: The `/ sizeof(char)` accounts that length is measured in 2-byte chars, not bytes.
4238
4339 // Note. In these SIMD implementations we leave some (< sizeof(nuint)) data from the hash.
4440 // For our use of hashing file paths, this is okay, as files with different names but same extension
4541 // would still hash differently. If I were to PR this to runtime though, this would need fixing.
4642
47- // Over 4 Vec256 regs (32 * 4 = 128 bytes)
48- if ( Vector256 . IsHardwareAccelerated && length >= ( sizeof ( Vector256 < ulong > ) / sizeof ( char ) ) * 4 )
43+ if ( Vector256 . IsHardwareAccelerated && length >= sizeof ( nuint ) * 8 )
4944 return text . UnstableHashVec256Lower ( ) ;
5045
51- // Over 4 Vec128 regs (16 * 4 = 64 bytes)
52- if ( Vector128 . IsHardwareAccelerated && length >= ( sizeof ( Vector128 < ulong > ) / sizeof ( char ) ) * 4 )
46+ if ( Vector128 . IsHardwareAccelerated && length >= sizeof ( nuint ) * 4 )
5347 return text . UnstableHashVec128Lower ( ) ;
5448#endif
5549
You can’t perform that action at this time.
0 commit comments