|
| Consider the following file to be compiled:
|
| (declaim (optimize (speed 3)
| (compilation-speed 0)
| (safety 0)
| (debug 0)))
|
| (defun assign (array value)
| (declare (type (simple-array fixnum (* *)) array))
| (declare (type fixnum value))
| (let ((size (array-dimension array 0))) ; don't worry,
array is square
| (dotimes (i size)
| (declare (type fixnum i))
| (dotimes (j size)
| (setf (aref array i j) value)))))
|
|
| The declaration of i as a fixnum seems to allow
CMU-CL to inline some
| operations on the loop. Otherwise, I would get a message
liike this:
|
<...>
| But do I really have the right to do so ? The
macro expansion of the
| function indicates that two consecutive declarations for i
are issued in that
| case.
CMUCL inserts the declaration of UNSIGNED-BYTE for each
counter,
meaning not negative integer.
|
| Also, I don't understand why CMU-CL gives me no note at
all about the loop on
| J, which behaves exactly the same.
The compiler notes are about the computation for the actual
element offset. The
sum of two fixnums can be greater than the fixnum range. If
you constrain your
SIZE
variable to something less than 1/2 max fixnum then the
notes will go away.
Paul
|
|