1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-12 06:41:13 +02:00

fix hash of zero-length vectors

* libguile/hash.c (scm_raw_ihash): Fix for zero-length vectors.
This commit is contained in:
Andy Wingo 2011-10-27 14:00:38 +02:00
parent 4938d3cb74
commit 549333efd8

View file

@ -286,8 +286,9 @@ scm_raw_ihash (SCM obj, size_t depth)
size_t len = SCM_SIMPLE_VECTOR_LENGTH (obj); size_t len = SCM_SIMPLE_VECTOR_LENGTH (obj);
size_t i = depth / 2; size_t i = depth / 2;
unsigned long h = scm_raw_ihashq (SCM_CELL_WORD_0 (obj)); unsigned long h = scm_raw_ihashq (SCM_CELL_WORD_0 (obj));
while (i--) if (len)
h ^= scm_raw_ihash (scm_c_vector_ref (obj, h % len), i); while (i--)
h ^= scm_raw_ihash (scm_c_vector_ref (obj, h % len), i);
return h; return h;
} }
case scm_tcs_cons_imcar: case scm_tcs_cons_imcar: