Skip to content
Snippets Groups Projects
Commit 942b8f79 authored by dtc's avatar dtc
Browse files

Take a little more care with the :start and :end arguments to the

subseq transform, limiting the :end to the string length and the
:start to the :end.
parent f7dc9e81
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@
;;; Carnegie Mellon University, and has been placed in the public domain.
;;;
(ext:file-comment
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/generic/vm-tran.lisp,v 1.39 2000/01/14 19:48:43 dtc Exp $")
"$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/compiler/generic/vm-tran.lisp,v 1.40 2000/09/14 14:34:37 dtc Exp $")
;;;
;;; **********************************************************************
;;;
......@@ -140,9 +140,11 @@
(deftransform subseq ((string start &optional (end nil))
(simple-string t &optional t))
'(let* ((length (- (or end (length string))
start))
(result (make-string length)))
'(let* ((length (length string))
(end (if end (min end length) length))
(start (min start end))
(size (- end start))
(result (make-string size)))
(declare (optimize (safety 0)))
(bit-bash-copy string
(the index
......@@ -150,7 +152,7 @@
vector-data-bit-offset))
result
vector-data-bit-offset
(the index (* length vm:byte-bits)))
(the index (* size vm:byte-bits)))
result))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment