From 74e5383aa57926b980f61cb2c49fb1202ec411a7 Mon Sep 17 00:00:00 2001 From: Douglas Katzman Date: Wed, 19 Apr 2017 23:41:17 -0400 Subject: [PATCH] Fix hopscotch tests, again. And change the resize to upgrade from fast hash-fun to good hash-fun when the *new* table, not the old, demands a large hop range. --- src/runtime/hopscotch.c | 5 ++--- tests/hopscotch.impure-cload.lisp | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/runtime/hopscotch.c b/src/runtime/hopscotch.c index 90ef8448b..7f187e99c 100644 --- a/src/runtime/hopscotch.c +++ b/src/runtime/hopscotch.c @@ -340,9 +340,8 @@ tableptr hopscotch_resize_up(tableptr ht) size *= 2; hopscotch_create(©, ht->hashfun, ht->value_size, size, 0); // Maybe change the hash function if it's the dumb one - if (ht->hop_range > 16 && ht->hash == 0) - ht->hash = hopscotch_hmix; - copy.hash = ht->hash; // in case DEFAULT was upgraded to MIX + if (copy.hop_range > 16 && copy.hash == 0) + copy.hash = hopscotch_hmix; copy.rehashing = 1; // Causes put() to return 0 on failure if (ht->values) { for(i=old_max_index ; i >= 0 ; --i) diff --git a/tests/hopscotch.impure-cload.lisp b/tests/hopscotch.impure-cload.lisp index eb8537fc3..425096a9c 100644 --- a/tests/hopscotch.impure-cload.lisp +++ b/tests/hopscotch.impure-cload.lisp @@ -21,7 +21,7 @@ (alien-funcall (extern-alien "hopscotch_create" (function void system-area-pointer int int int int)) ht - 0 ; default hash function + 1 ; default hash function bytes-per-value 32 ; size 8)) ; hop range -- 2.11.4.GIT