Changeset 15269


Ignore:
Timestamp:
Mar 23, 2012, 12:53:21 AM (7 years ago)
Author:
gb
Message:

compile-ccl.lisp: No more :mixup-hash-code-nop optional feature.
l0-hash.lisp: use a hopefully sound MIXUP-HASH-CODE function.

Location:
trunk/source
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/level-0/l0-hash.lisp

    r15264 r15269  
    145145      (setf (nhash.vector.flags vector) (logior (ash 1 $nhash_key_moved_bit) flags)))))
    146146
    147 #+32-bit-target
     147;;;
     148;;; This is a fairly straightforward translation of the "one-at-a-time"
     149;;; hash function described at:
     150;;; http://www.burtleburtle.net/bob/hash/doobs.html
     151;;;
    148152(defun mixup-hash-code (fixnum)
    149   (declare (fixnum fixnum))
    150   #+mixup-hash-code-nop
    151   fixnum
    152   #-mixup-hash-code-nop
    153   (the fixnum
    154     (+ fixnum
    155        (the fixnum (%ilsl (- 32 8)
    156                           (logand (1- (ash 1 (- 8 3))) fixnum))))))
    157 
    158 #+64-bit-target
    159 (defun mixup-hash-code (fixnum)
    160   (declare (fixnum fixnum))
    161   #+mixup-hash-code-nop
    162   fixnum
    163   #-mixup-hash-code-nop
    164   (the fixnum
    165     (+ fixnum
    166        (the fixnum (%ilsl 50
    167                           (logand (1- (ash 1 (- 8 3))) fixnum))))))
    168 
    169 
     153  (declare (fixnum fixnum)
     154           (optimize (speed 3) (safety 0)))
     155  (setq fixnum (logand fixnum target::most-positive-fixnum))
     156  (do* ((hash 0))
     157       ((zerop fixnum)
     158        (setq hash (+ hash (the fixnum (ash hash 3)))
     159              hash (logxor hash (the fixnum (ash hash -11))))
     160        (the fixnum (+ hash (the fixnum (ash hash 15)))))
     161    (declare (fixnum hash))
     162    (setq hash (+ hash (the fixnum (logand fixnum #xff)))
     163          fixnum (ash fixnum -8)
     164          hash (+ hash (the fixnum (ash hash 10)))
     165          hash (logxor hash (the fixnum (ash hash -6))))))
     166         
    170167(defun rotate-hash-code (fixnum)
    171168  (declare (fixnum fixnum))
  • trunk/source/lib/compile-ccl.lisp

    r15264 r15269  
    576576        (format nil "Error executing ~a: ~a~&~a" procname string reminder)))))
    577577
    578 (defparameter *known-optional-features* '(:count-gf-calls :monitor-futex-wait :unique-dcode :qres-ccl :eq-hash-monitor :mixup-hash-code-nop))
     578(defparameter *known-optional-features* '(:count-gf-calls :monitor-futex-wait :unique-dcode :qres-ccl :eq-hash-monitor))
    579579(defvar *build-time-optional-features* nil)
    580580(defvar *ccl-save-source-locations* :no-text)
Note: See TracChangeset for help on using the changeset viewer.