mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-27 06:48:33 +00:00
Common: Merge CRC32.h into Hash.h
This makes it easier to find the relevant functions.
This commit is contained in:
parent
85d2ea0dd2
commit
2652aed85c
7 changed files with 16 additions and 35 deletions
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <zlib.h>
|
||||
|
||||
#include "Common/BitUtils.h"
|
||||
#include "Common/CPUDetect.h"
|
||||
#include "Common/CommonFuncs.h"
|
||||
|
@ -529,4 +531,14 @@ void SetHash64Function()
|
|||
ptrHashFunction = &GetMurmurHash3;
|
||||
}
|
||||
}
|
||||
|
||||
u32 ComputeCRC32(std::string_view data)
|
||||
{
|
||||
const Bytef* buf = reinterpret_cast<const Bytef*>(data.data());
|
||||
uInt len = static_cast<uInt>(data.size());
|
||||
// Use zlib's crc32 implementation to compute the hash
|
||||
u32 hash = crc32(0L, Z_NULL, 0);
|
||||
hash = crc32(hash, buf, len);
|
||||
return hash;
|
||||
}
|
||||
} // namespace Common
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue