Re: declare 64 bit integers?



On Sep 29, 12:56 pm, "Alex Mizrahi" <udode...@xxxxxxxxxxxxxxxxxxxxx>
wrote:
[for SBCL on x86_64]
so fixnums are just 61 bit wide, that's not interesting. how to declare
64-bit interger value?

You can work with unboxed 64 bit integers in the same way as with
unboxed floats: do not store them into a universal storage (e.g. a
list or a non-specialized vector), do not pass as arguments to a
global function, and do not return. For example:

(defun checksum (vector result)
(declare (type (simple-array (unsigned-byte 64) (*)) vector)
(type (simple-array (unsigned-byte 64) ()) result))
(loop for x of-type (unsigned-byte 64) across vector
for s of-type (unsigned-byte 64) = x then (logxor s x)
finally (setf (aref result) s))
result)

.