[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

hash table types



    Date: 17 May 85  0841 PDT
    From: Jon White <JLW@SU-AI.ARPA>

    Your list of "external things [I] see need changing" looks quite good
    to me.  I might add the suggestion that we add a ROT primitive to CL
    which is machine independent.  The following definition got added to
    Interlisp shortly after I went to Xerox:
      (ROT x n fieldsize)
    "performs a bitwise left-rotation of the integer x, by n places, within
    a field of fieldsize bits wide.  Bits shifted out of the position selected
    by (expt 2 (sub1 fieldsize)) will flow into the 'units' position."

    Now, this definition has the advantage that on many machines, there will be
    one particular field size for which the implementation of this ROT will be
    very efficient (i.e., the one actually supported by a hardware ROT instruction).
    And since SXHASH is permitted to be implemetation dependent -- not "address
    dependent", but rather varying between one implementation and another -- then
    each implementation can use a ROT in it's sxhash with a field size that is
    efficient.

I wouldn't object to this, but a refinement is necessary.  Is ROT
supposed to give the same answer in all implementations?  On two's
complement machines, (rot 1 (1- n) n) where N is the word width is
(probably) MOST-NEGATIVE-FIXNUM.  Also, (rot 1 (1- n) n) == (ash -1 (1- n)).
In other words, ROT should imply sign extension (on two's complement
machines).