Update of /project/crypticl/cvsroot/crypticl/src In directory clnet:/tmp/cvs-serv23178
Modified Files: utilities.lisp Log Message: Adding acopy and make-byte-array for octet arrays.
--- /project/crypticl/cvsroot/crypticl/src/utilities.lisp 2007/01/23 23:55:39 1.10 +++ /project/crypticl/cvsroot/crypticl/src/utilities.lisp 2007/02/04 20:58:00 1.11 @@ -159,8 +159,8 @@ new-string (format nil "~A" (aref string i))))))))
-(defun octet-vector-copy (in &optional (start 0) (end (length in)) - out (out-start 0)) +(defun octet-vector-copy (in &optional (start 0) (end (length in)) + out (out-start 0)) "Returns copy of input vector or copies it into out at the given offset." (let ((size (- end start))) (unless out @@ -168,6 +168,16 @@ (dotimes (i size out) (setf (aref out (+ out-start i)) (aref in (+ start i))))))
+ +(defun acopy (in &key (start 0) (size (length in)) + out (out-start 0)) + "array copy" + (unless out + (setf out (make-byte-array size))) + (dotimes (i size out) + (setf (aref out (+ out-start i)) (aref in (+ start i))))) + + (defun concat (&rest args) "Concatenates strings and vectors. WARNING! Will not work correctly if you mix strings and other vectors. @@ -241,4 +251,6 @@ the same platform." (map 'string #'code-char octet-vector))
- \ No newline at end of file + +(defun make-byte-array (size) + (make-array size :element-type '(unsigned-byte 8) :initial-element 0)) \ No newline at end of file