From: Juho S. <js...@ik...> - 2006-10-27 15:58:08
|
Andras Simon <as...@ma...> writes: > Following Juho Snellman's nicely commented example on > http://paste.lisp.org/display/27891 I tried to write out/mmap in > arrays on both 32 and 64 bit sbcl (both on Linux). It went > smoothly on x86, but on x86_64 I get the following: > > (require 'sb-posix) > > (defvar *a*) > > (defun create-lisp-mem-from-array (array file) > (declare (optimize (speed 1))) > (with-open-file (map-file file > :direction :output > :if-exists :supersede > :element-type '(unsigned-byte 64)) Ah, I forgot to mention that the code at that paste won't work with a vanilla SBCL, since the code for handling (u-b 64) streams with the correct endianity is missing. You need to add the following into src/code/fd-stream.lisp, along with the other def-output-routines forms. (def-output-routines ("OUTPUT-UNSIGNED-LONG-~A-BUFFERED" 8 nil (:none (unsigned-byte 64)) (:full (unsigned-byte 64))) (setf (sap-ref-64 (fd-stream-obuf-sap stream) (fd-stream-obuf-tail stream)) byte)) (def-output-routines ("OUTPUT-SIGNED-LONG-~A-BUFFERED" 8 nil (:none (signed-byte 64)) (:full (signed-byte 64))) (setf (signed-sap-ref-64 (fd-stream-obuf-sap stream) (fd-stream-obuf-tail stream)) byte)) -- Juho Snellman |