Fix SSE instructions

This commit is contained in:
Oleksandr Melnyk 2022-06-05 19:18:00 +03:00
parent 7eb3f67feb
commit a19b68185e
2 changed files with 6 additions and 6 deletions

View File

@ -96,8 +96,8 @@ namespace Standart.Hash.xxHash
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
private static unsafe uint128 XXH_mult64to128_bmi2(ulong lhs, ulong rhs) private static unsafe uint128 XXH_mult64to128_bmi2(ulong lhs, ulong rhs)
{ {
ulong product_high; ulong product_low;
ulong product_low = Bmi2.X64.MultiplyNoFlags(lhs, rhs, &product_high); ulong product_high = Bmi2.X64.MultiplyNoFlags(lhs, rhs, &product_low);
uint128 r128; uint128 r128;
r128.low64 = product_low; r128.low64 = product_low;
r128.high64 = product_high; r128.high64 = product_high;

View File

@ -507,13 +507,13 @@ namespace Standart.Hash.xxHash
fixed (byte* secret = &XXH3_SECRET[0]) fixed (byte* secret = &XXH3_SECRET[0])
{ {
for (int i = 0; i < XXH_SECRET_DEFAULT_SIZE / m128i_size; ++i) for (int i = 0; i < XXH_SECRET_DEFAULT_SIZE / m128i_size; i++)
{ {
int uint64_offset = i * 2; int uint64_offset = i * 2;
var src16 = Sse2.LoadVector128((long*) secret + uint64_offset); var src16 = Sse2.LoadVector128(((long*) secret) + uint64_offset);
var dst16 = Sse2.Add(src16, seed); var dst16 = Sse2.Add(src16, seed);
Sse2.Store((long*) customSecret, dst16); Sse2.Store((long*) customSecret + uint64_offset, dst16);
} }
} }