mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-14 21:37:52 -07:00
Merge pull request #2068 from mimimi085181/hash-fix
GetCRC32: Fix the hash for the last byte(s)
This commit is contained in:
commit
96041a5aca
@ -252,9 +252,14 @@ u64 GetCRC32(const u8 *src, u32 len, u32 samples)
|
||||
if (data < end - Step * 2)
|
||||
h[2] = _mm_crc32_u64(h[2], data[Step * 2]);
|
||||
|
||||
const u8 *data2 = (const u8*)end;
|
||||
if (len & 7)
|
||||
{
|
||||
u64 temp = 0;
|
||||
memcpy(&temp, end, len & 7);
|
||||
h[0] = _mm_crc32_u64(h[0], temp);
|
||||
}
|
||||
|
||||
// FIXME: is there a better way to combine these partial hashes?
|
||||
h[0] = _mm_crc32_u64(h[0], u64(data2[0]));
|
||||
return h[0] + (h[1] << 10) + (h[2] << 21) + (h[3] << 32);
|
||||
#else
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user