Changeset 5118


Ignore:
Timestamp:
Sep 5, 2006, 4:09:30 AM (18 years ago)
Author:
Gary Byers
Message:

Various archaic string functions: don't assume 8-bit strings.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/level-1/l1-aprims.lisp

    r4932 r5118  
    419419      (setf (%get-byte s len) 0)
    420420      (multiple-value-bind (data offset) (array-data-and-offset string)
    421         (%copy-ivector-to-ptr data offset s 0 len)
     421        (dotimes (i len s)
     422          (setf (%get-unsigned-byte s i) (%scharcode data (+ offset i))))
    422423        s))))
    423424
     
    432433
    433434(defun move-string-bytes (source dest off1 off2 n)
    434   (%copy-ivector-to-ivector source off1 dest off2 n))
     435  (declare (fixnum off1 off2 n)
     436           (simple-base-string source dest)
     437           (optimize (speed 3) (safety 0)))
     438  (dotimes (i n dest)
     439    (setf (schar dest off2) (schar source off1))
     440    (incf off1)
     441    (incf off2)))
    435442
    436443
     
    465472        (when (%i< start 0)(error "Negative start"))
    466473        (let ((new (make-string newlen)))
    467           (%copy-ivector-to-ivector str (%i+ start strb) new 0 newlen)
    468           new)))))
     474          (do* ((i 0 (1+ i))
     475                (pos (%i+ start strb) (1+ pos)))
     476               ((= i newlen) new)
     477            (declare (fixnum i pos))
     478            (setf (schar new i) (schar str pos))))))))
    469479
    470480
     
    510520      bit))
    511521 
    512   ; given uvector subtype - what is the corresponding element-type
     522  ;; given uvector subtype - what is the corresponding element-type
    513523  (defun element-subtype-type (subtype)
    514524    (declare (fixnum subtype))
Note: See TracChangeset for help on using the changeset viewer.