|
1 | 1 | // ReSharper disable InconsistentNaming |
2 | 2 |
|
3 | 3 | using System.Runtime.CompilerServices; |
| 4 | +using System.Runtime.Intrinsics; |
4 | 5 | using System.Runtime.Intrinsics.X86; |
5 | 6 |
|
6 | 7 | namespace Standart.Hash.xxHash |
7 | 8 | { |
8 | 9 | public static partial class xxHash128 |
9 | 10 | { |
10 | | - private const ulong XXH_PRIME64_1 = 11400714785074694791UL; |
11 | | - private const ulong XXH_PRIME64_2 = 14029467366897019727UL; |
12 | | - private const ulong XXH_PRIME64_3 = 1609587929392839161UL; |
13 | | - private const ulong XXH_PRIME64_4 = 9650029242287828579UL; |
14 | | - private const ulong XXH_PRIME64_5 = 2870177450012600261UL; |
15 | | - |
16 | | - private const uint XXH_PRIME32_1 = 2654435761U; |
17 | | - private const uint XXH_PRIME32_2 = 2246822519U; |
18 | | - private const uint XXH_PRIME32_3 = 3266489917U; |
19 | | - private const uint XXH_PRIME32_4 = 668265263U; |
20 | | - private const uint XXH_PRIME32_5 = 374761393U; |
| 11 | + private static readonly ulong XXH_PRIME64_1 = 11400714785074694791UL; |
| 12 | + private static readonly ulong XXH_PRIME64_2 = 14029467366897019727UL; |
| 13 | + private static readonly ulong XXH_PRIME64_3 = 1609587929392839161UL; |
| 14 | + private static readonly ulong XXH_PRIME64_4 = 9650029242287828579UL; |
| 15 | + private static readonly ulong XXH_PRIME64_5 = 2870177450012600261UL; |
| 16 | + |
| 17 | + private static readonly uint XXH_PRIME32_1 = 2654435761U; |
| 18 | + private static readonly uint XXH_PRIME32_2 = 2246822519U; |
| 19 | + private static readonly uint XXH_PRIME32_3 = 3266489917U; |
| 20 | + private static readonly uint XXH_PRIME32_4 = 668265263U; |
| 21 | + private static readonly uint XXH_PRIME32_5 = 374761393U; |
| 22 | + |
| 23 | + private static readonly int XXH_STRIPE_LEN = 64; |
| 24 | + private static readonly int XXH_ACC_NB = 8; |
| 25 | + private static readonly int XXH_SECRET_CONSUME_RATE = 8; |
| 26 | + private static readonly int XXH_SECRET_MERGEACCS_START = 11; |
| 27 | + private static readonly int XXH_SECRET_DEFAULT_SIZE = 192; |
| 28 | + private static readonly int XXH_SECRET_LASTACC_START = 7; |
| 29 | + |
| 30 | + private static readonly byte MM_SHUFFLE_0_3_0_1 = 0b0011_0001; |
| 31 | + private static readonly byte MM_SHUFFLE_1_0_3_2 = 0b0100_1110; |
| 32 | + |
| 33 | + [FixedAddressValueType] |
| 34 | + private static readonly Vector256<uint> M256i_XXH_PRIME32_1 = Vector256.Create(XXH_PRIME32_1); |
| 35 | + [FixedAddressValueType] |
| 36 | + private static readonly Vector128<uint> M128i_XXH_PRIME32_1 = Vector128.Create(XXH_PRIME32_1); |
21 | 37 |
|
22 | | - private const int XXH_STRIPE_LEN = 64; |
23 | | - private const int XXH_ACC_NB = XXH_STRIPE_LEN / 8; |
24 | | - private const int XXH_SECRET_CONSUME_RATE = 8; |
25 | | - private const int XXH_SECRET_MERGEACCS_START = 11; |
26 | | - private const int XXH_SECRET_DEFAULT_SIZE = 192; |
27 | | - private const int XXH_SECRET_LASTACC_START = 7; |
28 | 38 |
|
29 | 39 | [MethodImpl(MethodImplOptions.AggressiveInlining)] |
30 | 40 | private static uint XXH_rotl32(uint x, int r) |
|
0 commit comments