Skip to content

Commit

Permalink
Optimize copy-mem.
Browse files Browse the repository at this point in the history
  • Loading branch information
stassats committed Feb 18, 2012
1 parent c69ebc1 commit cdd4c29
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions io-sbcl.lisp
Expand Up @@ -121,18 +121,18 @@

(declaim (inline copy-mem))
(defun copy-mem (from to length)
(multiple-value-bind (words rest) (truncate length sb-vm:n-word-bytes)
(loop repeat words
for i by sb-vm:n-word-bytes
(let ((words-end (- length (rem length sb-vm:n-word-bytes))))
(loop for i by sb-vm:n-word-bytes below words-end
do (setf (sb-sys:sap-ref-word to i)
(sb-sys:sap-ref-word from i)))
(loop for i from (- length rest) below length
(loop for i from words-end below length
do (setf (sb-sys:sap-ref-8 to i)
(sb-sys:sap-ref-8 from i)))))

(declaim (inline read-ascii-string-optimized))
(defun read-ascii-string-optimized (length string stream)
(declare (type fixnum length))
(declare (type fixnum length)
(optimize speed))
(sb-sys:with-pinned-objects (string)
(let ((mmap-sap (advance-stream length stream))
(string-sap (sb-sys:vector-sap string)))
Expand Down

0 comments on commit cdd4c29

Please sign in to comment.