From: William Harold Newman Date: Tue, 2 Nov 2004 16:53:10 +0000 (+0000) Subject: 0.8.16.27: X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=dc9d03a1c43398d3a860520c6ea03e8d5838d142;p=sbcl.git 0.8.16.27: made SXHASH values for CLOS instances be well-distributed --- diff --git a/src/pcl/low.lisp b/src/pcl/low.lisp index ea468f4..021c50e 100644 --- a/src/pcl/low.lisp +++ b/src/pcl/low.lisp @@ -306,12 +306,19 @@ nil))) ;;;; support for useful hashing of PCL instances -(let ((hash-code 0)) - (declare (fixnum hash-code)) - (defun get-instance-hash-code () - (if (< hash-code most-positive-fixnum) - (incf hash-code) - (setq hash-code 0)))) + +(defvar *instance-hash-code-random-state* (make-random-state)) +(defun get-instance-hash-code () + ;; ANSI SXHASH wants us to make a good-faith effort to produce + ;; hash-codes that are well distributed within the range of + ;; non-negative fixnums, and this RANDOM operation does that, unlike + ;; the sbcl<=0.8.16 implementation of this operation as + ;; (INCF COUNTER). + ;; + ;; Hopefully there was no virtue to the old counter implementation + ;; that I am insufficiently insightful to insee. -- WHN 2004-10-28 + (random most-positive-fixnum + *instance-hash-code-random-state*)) (defun sb-impl::sxhash-instance (x) (cond diff --git a/version.lisp-expr b/version.lisp-expr index c9cbb67..bb81a17 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"0.8.16.26" +"0.8.16.27"