mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-13 23:20:32 +02:00
fix hash of zero-length vectors
* libguile/hash.c (scm_raw_ihash): Fix for zero-length vectors.
This commit is contained in:
parent
4938d3cb74
commit
549333efd8
1 changed files with 3 additions and 2 deletions
|
@ -286,6 +286,7 @@ 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));
|
||||||
|
if (len)
|
||||||
while (i--)
|
while (i--)
|
||||||
h ^= scm_raw_ihash (scm_c_vector_ref (obj, h % len), i);
|
h ^= scm_raw_ihash (scm_c_vector_ref (obj, h % len), i);
|
||||||
return h;
|
return h;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue