[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: SXHASH isn't process-independent (bug)
From: Jeff Dalton
Subject: SXHASH isn't process-independent (bug)
Date: Tue, 8 Dec 87
SXHASH, According to Steele, page 285, must have the following property:
...
However, KCL SXHASHes symbols simply by casting them to integers (taking
their address as a fixnum). Hence it is not invocation-independent.
For example,
...
SXHASH should change, but the hash for EQ hash tables, used now by SXHASH,
should not change since it doesn't need to have this property.
There was a bug in the definition of the C function hash_eql
in file c/hash.d. To fix the bug, replace the first lines of the definition
int
hash_eql(x)
object x;
{
int h;
switch (type_of(x)) {
case t_fixnum:
return(fix(x));
...
}
with
int
hash_eql(x)
object x;
{
=> int h = 0, i;
char *s;
switch (type_of(x)) {
=> case t_symbol:
=> for (i = x->s.s_fillp, s = x->s.s_self; i > 0; --i, s++)
=> h += (*s & 0377)*12345 + 1;
=> return(h);
case t_fixnum:
return(fix(x));
...
}
-- Taiichi