Commit 68207537 authored by Wayne Davison's avatar Wayne Davison

Renamed sum_table -> hash_table.

parent fbbe9a01
...@@ -38,7 +38,7 @@ static int total_matches; ...@@ -38,7 +38,7 @@ static int total_matches;
extern struct stats stats; extern struct stats stats;
static uint32 tablesize; static uint32 tablesize;
static int32 *sum_table; static int32 *hash_table;
#define SUM2HASH(sum) ((sum)%tablesize) #define SUM2HASH(sum) ((sum)%tablesize)
...@@ -54,18 +54,18 @@ static void build_hash_table(struct sum_struct *s) ...@@ -54,18 +54,18 @@ static void build_hash_table(struct sum_struct *s)
if (tablesize < 65537) if (tablesize < 65537)
tablesize = 65537; /* a prime number */ tablesize = 65537; /* a prime number */
if (tablesize != prior_size) { if (tablesize != prior_size) {
free(sum_table); free(hash_table);
sum_table = new_array(int32, tablesize); hash_table = new_array(int32, tablesize);
if (!sum_table) if (!hash_table)
out_of_memory("build_hash_table"); out_of_memory("build_hash_table");
} }
memset(sum_table, 0xFF, tablesize * sizeof sum_table[0]); memset(hash_table, 0xFF, tablesize * sizeof hash_table[0]);
for (i = 0; i < s->count; i++) { for (i = 0; i < s->count; i++) {
uint32 t = SUM2HASH(s->sums[i].sum1); uint32 t = SUM2HASH(s->sums[i].sum1);
s->sums[i].chain = sum_table[t]; s->sums[i].chain = hash_table[t];
sum_table[t] = i; hash_table[t] = i;
} }
} }
...@@ -166,7 +166,7 @@ static void hash_search(int f,struct sum_struct *s, ...@@ -166,7 +166,7 @@ static void hash_search(int f,struct sum_struct *s,
if (verbose > 4) if (verbose > 4)
rprintf(FINFO,"offset=%.0f sum=%08x\n",(double)offset,sum); rprintf(FINFO,"offset=%.0f sum=%08x\n",(double)offset,sum);
i = sum_table[SUM2HASH(sum)]; i = hash_table[SUM2HASH(sum)];
if (i < 0) if (i < 0)
goto null_hash; goto null_hash;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment