[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
SXHASH and/or ABS peculiarities
- To: rivest at MIT-ML
- Subject: SXHASH and/or ABS peculiarities
- From: Jon L White <JONL at MIT-MC>
- Date: Fri, 3 Jul 81 18:45:00 GMT
- Cc: BUG-LISP at MIT-MC, Guy.Steele at CMU-10A
- Original-date: 3 July 1981 14:45-EDT
In your note of
From: RIVEST@MIT-ML
Date: Mon, 23 Jun 81 04:15:05 GMT
Original-Date: 06/23/81 00:15:05 EDT
Subject:
you have the function
(defun count-hash-index (expr)
(remainder (abs (sxhash expr)) 5000.))
If the ABS is open-compiled here, you will lose; however,
such a function would not normally cause ABS to be open-compiled.
The generic-arithemtic works ok on this example.
However, note the following emmendation of 'count-hash-index', which
will be optimally fast (no closed-codings) by checking explicitly for
the overflow case:
(defun count-hash-index (expr)
(let ((n (sxhash expr)))
(declare (fixnum n))
(if (= n -1_35.)
#.(remainder (abs -1_35.) 5000.)
(\ (abs n) 5000.))))