diff options
author | Andy Wingo <wingo@pobox.com> | 2011-10-27 14:00:38 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2011-10-27 14:00:38 +0200 |
commit | 549333efd898889f4b99b2d4f8986a098121c620 (patch) | |
tree | 4e635c3b069909bd26b2c4e707716d18a395a7d9 /libguile/hash.c | |
parent | 4938d3cb742de2a356586c55e5af32e193c5990b (diff) |
fix hash of zero-length vectors
* libguile/hash.c (scm_raw_ihash): Fix for zero-length vectors.
Diffstat (limited to 'libguile/hash.c')
-rw-r--r-- | libguile/hash.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libguile/hash.c b/libguile/hash.c index ab47008f0..d47c7e054 100644 --- a/libguile/hash.c +++ b/libguile/hash.c @@ -286,8 +286,9 @@ scm_raw_ihash (SCM obj, size_t depth) size_t len = SCM_SIMPLE_VECTOR_LENGTH (obj); size_t i = depth / 2; unsigned long h = scm_raw_ihashq (SCM_CELL_WORD_0 (obj)); - while (i--) - h ^= scm_raw_ihash (scm_c_vector_ref (obj, h % len), i); + if (len) + while (i--) + h ^= scm_raw_ihash (scm_c_vector_ref (obj, h % len), i); return h; } case scm_tcs_cons_imcar: |