forcing xxhash to use the stack instead of the heap
This commit is contained in:
@@ -388,18 +388,17 @@ static void xxh3_hash_file_stream(const char *path, char *out_hex) {
|
||||
return;
|
||||
}
|
||||
XXH128_hash_t h;
|
||||
XXH3_state_t *state = XXH3_createState();
|
||||
XXH3_128bits_reset(state);
|
||||
XXH3_state_t state;
|
||||
XXH3_128bits_reset(&state);
|
||||
|
||||
BYTE *buf = (BYTE *)malloc(READ_BLOCK);
|
||||
DWORD read = 0;
|
||||
BOOL ok;
|
||||
while (ReadFile(hFile, buf, READ_BLOCK, &read, NULL) && read > 0) {
|
||||
XXH3_128bits_update(state, buf, (size_t)read);
|
||||
XXH3_128bits_update(&state, buf, (size_t)read);
|
||||
atomic_fetch_add(&g_bytes_processed, (uint64_t)read);
|
||||
}
|
||||
h = XXH3_128bits_digest(state);
|
||||
XXH3_freeState(state);
|
||||
h = XXH3_128bits_digest(&state);
|
||||
CloseHandle(hFile);
|
||||
free(buf);
|
||||
snprintf(out_hex, HASH_STRLEN, "%016llx%016llx", (unsigned long long)h.high64,
|
||||
|
||||
Reference in New Issue
Block a user