mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-20 11:32:35 -08:00
Hashing of base strings has to be done using unsigned characters, to be compatible with extended strings.
This commit is contained in:
parent
19618912c8
commit
6fe9d192ad
2 changed files with 6 additions and 5 deletions
|
|
@ -92,12 +92,14 @@ _hash_equal(int depth, cl_hashkey h, cl_object x)
|
|||
x = x->symbol.name;
|
||||
#ifdef ECL_UNICODE
|
||||
case t_base_string:
|
||||
return hash_base_string(x->base_string.self, x->base_string.fillp, h);
|
||||
return hash_base_string((unsigned char *)x->base_string.self,
|
||||
x->base_string.fillp, h);
|
||||
case t_string:
|
||||
return hash_full_string(x->base_string.self, x->base_string.fillp, h);
|
||||
return hash_full_string(x->string.self, x->string.fillp, h);
|
||||
#else
|
||||
case t_base_string:
|
||||
return hash_string(h, x->base_string.self, x->base_string.fillp);
|
||||
return hash_string(h, (unsigned char *)x->base_string.self,
|
||||
x->base_string.fillp);
|
||||
#endif
|
||||
case t_pathname:
|
||||
h = _hash_equal(0, h, x->pathname.directory);
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ static cl_index hash_word(cl_index c, cl_index w)
|
|||
return c;
|
||||
}
|
||||
|
||||
static cl_index hash_base_string(const char *s, cl_index len, cl_index h)
|
||||
static cl_index hash_base_string(const unsigned char *s, cl_index len, cl_index h)
|
||||
{
|
||||
cl_index a = GOLDEN_RATIO, b = GOLDEN_RATIO, i;
|
||||
for (i = len; i >= 3; i -= 3) {
|
||||
|
|
@ -179,4 +179,3 @@ static cl_index hash_full_string(const cl_object *s, cl_index len, cl_index h)
|
|||
mix(a, b, h);
|
||||
return h;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue