nil)))
\f
;;;; 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
;;; 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"