mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-06-12 21:27:44 +02:00
refactored hassing task
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
@ -9,17 +9,23 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <fstream>
|
||||
|
||||
#include <functional>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
namespace Murmur2 {
|
||||
|
||||
#define KiB 1024
|
||||
#define MiB 1024 * KiB
|
||||
|
||||
uint32_t MurmurHash2(
|
||||
std::ifstream&& file_stream,
|
||||
class Reader {
|
||||
public:
|
||||
virtual ~Reader() = default;
|
||||
virtual int read(char* s, int n) = 0;
|
||||
virtual bool eof() = 0;
|
||||
virtual void goToBegining() = 0;
|
||||
};
|
||||
|
||||
uint32_t hash(
|
||||
Reader* file_stream,
|
||||
std::size_t buffer_size = 4 * MiB,
|
||||
std::function<bool(char)> filter_out = [](char) { return false; });
|
||||
|
||||
@ -29,5 +35,4 @@ struct IncrementalHashInfo {
|
||||
};
|
||||
|
||||
void FourBytes_MurmurHash2(const unsigned char* data, IncrementalHashInfo& prev);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
} // namespace Murmur2
|
||||
|
Reference in New Issue
Block a user