1
0
mirror of https://github.com/facebook/zstd.git synced 2025-08-01 09:47:01 +03:00

fixed file identity detection in 32-bit mode

also :
some library decided to use `index` as a global variable declared in standard header
shadowing the ones used in fastcover.c  :(
This commit is contained in:
Yann Collet
2018-12-20 14:30:30 -08:00
parent 65a441a8f0
commit ffba142406
2 changed files with 5 additions and 6 deletions

View File

@ -159,15 +159,15 @@ static COVER_segment_t FASTCOVER_selectSegment(const FASTCOVER_ctx_t *ctx,
*/ */
while (activeSegment.end < end) { while (activeSegment.end < end) {
/* Get hash value of current dmer */ /* Get hash value of current dmer */
const size_t index = FASTCOVER_hashPtrToIndex(ctx->samples + activeSegment.end, f, d); const size_t idx = FASTCOVER_hashPtrToIndex(ctx->samples + activeSegment.end, f, d);
/* Add frequency of this index to score if this is the first occurence of index in active segment */ /* Add frequency of this index to score if this is the first occurence of index in active segment */
if (segmentFreqs[index] == 0) { if (segmentFreqs[idx] == 0) {
activeSegment.score += freqs[index]; activeSegment.score += freqs[idx];
} }
/* Increment end of segment and segmentFreqs*/ /* Increment end of segment and segmentFreqs*/
activeSegment.end += 1; activeSegment.end += 1;
segmentFreqs[index] += 1; segmentFreqs[idx] += 1;
/* If the window is now too large, drop the first position */ /* If the window is now too large, drop the first position */
if (activeSegment.end - activeSegment.begin == dmersInK + 1) { if (activeSegment.end - activeSegment.begin == dmersInK + 1) {
/* Get hash value of the dmer to be eliminated from active segment */ /* Get hash value of the dmer to be eliminated from active segment */

View File

@ -16,11 +16,10 @@ extern "C" {
/*-**************************************** /*-****************************************
* Dependencies * Dependencies
******************************************/ ******************************************/
#include <string.h> /* strncmp */ #include "util.h" /* note : ensure that platform.h is included first ! */
#include <errno.h> #include <errno.h>
#include <assert.h> #include <assert.h>
#include "util.h"
int UTIL_fileExist(const char* filename) int UTIL_fileExist(const char* filename)
{ {