/[cmucl]/src/code/hash.lisp
ViewVC logotype

Diff of /src/code/hash.lisp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by wlott, Fri Aug 24 18:11:19 1990 UTC revision 1.3 by ram, Thu Oct 4 14:36:09 1990 UTC
# Line 362  Line 362 
362    
363  (eval-when (compile eval)  (eval-when (compile eval)
364    
365    (defconstant sxhash-bits-byte (byte 23 0))
366  (defconstant sxmash-total-bits 26)  (defconstant sxmash-total-bits 26)
367  (defconstant sxmash-rotate-bits 7)  (defconstant sxmash-rotate-bits 7)
368    
# Line 418  Line 418 
418      ;; The pointers and immediate types.      ;; The pointers and immediate types.
419      (list (sxhash-list s-expr depth))      (list (sxhash-list s-expr depth))
420      (fixnum      (fixnum
421       (ldb (byte 23 0) s-expr))       (ldb sxhash-bits-byte s-expr))
422      #+nil      #+nil
423      (structure ???)      (structure ???)
424      ;; Other-pointer types.      ;; Other-pointer types.
# Line 426  Line 426 
426      (symbol (sxhash-simple-string (symbol-name s-expr)))      (symbol (sxhash-simple-string (symbol-name s-expr)))
427      (number      (number
428       (etypecase s-expr       (etypecase s-expr
429         (integer (ldb (byte 23 0) s-expr))         (integer (ldb sxhash-bits-byte s-expr))
430         (float (multiple-value-bind (significand exponent)         (single-float
431                                     (integer-decode-float s-expr)          (let ((bits (vm:single-float-bits s-expr)))
432                  (logxor (the fixnum (ldb (byte 23 0) significand))            (ldb sxhash-bits-byte
433                          (the fixnum (ldb (byte 23 0) exponent)))))                 (logxor (ash bits (- sxmash-rotate-bits))
434                           bits))))
435           (double-float
436            (let* ((val s-expr)
437                   (lo (vm:double-float-low-bits val))
438                   (hi (vm:double-float-high-bits val)))
439              (ldb sxhash-bits-byte
440                   (logxor (ash lo (- sxmash-rotate-bits))
441                           (ash hi (- sxmash-rotate-bits))
442                           lo hi))))
443         (ratio (the fixnum (+ (internal-sxhash (numerator s-expr) 0)         (ratio (the fixnum (+ (internal-sxhash (numerator s-expr) 0)
444                               (internal-sxhash (denominator s-expr) 0))))                               (internal-sxhash (denominator s-expr) 0))))
445         (complex (the fixnum (+ (internal-sxhash (realpart s-expr) 0)         (complex (the fixnum (+ (internal-sxhash (realpart s-expr) 0)
# Line 442  Line 451 
451      #+nil      #+nil
452      (compiled-function (%primitive header-length s-expr))      (compiled-function (%primitive header-length s-expr))
453      ;; Everything else.      ;; Everything else.
454      (t (%primitive make-fixnum s-expr))))      (t 42)))

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.5