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

SXHASH and/or ABS peculiarities



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.))))