[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
sxhash
Problem: sxhash does not return a value independent of the core image
for symbols, and packages.
Fix:
Alter the code in hash.d as follows:
*** /usr/local/src/kcl/c/hash.d Wed Jun 3 14:05:36 1987
--- c/hash.d Sun Feb 28 14:11:29 1988
***************
*** 74,83 ****
for (i = x->st.st_fillp, s = x->st.st_self; i > 0; --i, s++)
h += (*s & 0377)*12345 + 1;
return(h);
!
! case t_bitvector:
return(h);
case t_pathname:
h += hash_equal(x->pn.pn_host);
h += hash_equal(x->pn.pn_device);
--- 74,93 ----
for (i = x->st.st_fillp, s = x->st.st_self; i > 0; --i, s++)
h += (*s & 0377)*12345 + 1;
return(h);
! case t_symbol:
! /* case t_string could share this code--wfs
! Do the first four chars cast to int give sufficient
! hash for reasonable lookup? I hope so --wfs */
! if (x->st.st_fillp < sizeof(int))
! for (i = x->st.st_fillp ,s = x->st.st_self; i > 0; --i, s++)
! h += (*s & 0377)*12345 + 1;
! else
! h += ((*((int *)x->s.s_self))/4);
return(h);
+ case t_package:
+ case t_bitvector: return(h);
+
case t_pathname:
h += hash_equal(x->pn.pn_host);
h += hash_equal(x->pn.pn_device);
***************