- Timestamp:
- Apr 21, 2010, 9:46:31 AM (15 years ago)
- Location:
- release/1.5/source
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
level-1/l1-streams.lisp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
release/1.5/source
- Property svn:mergeinfo changed
/trunk/source merged: 13648
- Property svn:mergeinfo changed
-
release/1.5/source/level-1/l1-streams.lisp
r13499 r13650 6154 6154 (declare ((simple-array (unsigned-byte 8) (*)) data) 6155 6155 (fixnum offset)) 6156 (%copy-ivector-to-ivector new 0 dataoffset len)6156 (%copy-ivector-to-ivector data 0 new offset len) 6157 6157 (setf (vector-output-stream-ioblock-displacement ioblock) 0) 6158 6158 (unless (= 0 offset) … … 6176 6176 (declare (fixnum len newlen) 6177 6177 ((simple-array (unsigned-byte 8) (*)) old new)) 6178 (%copy-ivector-to-ivector new 0 old0 len)6178 (%copy-ivector-to-ivector old 0 new 0 len) 6179 6179 (setf (io-buffer-buffer outbuf) new 6180 6180 (io-buffer-size outbuf) newlen … … 6218 6218 6219 6219 6220 (defun unsigned-integer-to-binary (value len s) 6220 (defmethod unsigned-integer-to-binary (value len (s binary-output-stream)) 6221 (unless (typep value 'unsigned-byte) 6222 (report-bad-arg value 'unsigned-byte)) 6223 (do* ((shift (ash (1- len) 3) (- shift 8))) 6224 ((< shift 0) value) 6225 (write-byte (logand #xff (ash value (- shift))) s))) 6226 6227 (defun %unsigned-integer-to-binary (value len s) 6221 6228 (declare (fixnum len)) 6222 6229 (unless (and (typep s 'basic-stream) … … 6277 6284 (incf idx)))))))) 6278 6285 6279 (defun signed-integer-to-binary (value len s) 6286 (defmethod unsigned-integer-to-binary (value len (s vector-output-stream)) 6287 (%unsigned-integer-to-binary value len s)) 6288 6289 (defun %signed-integer-to-binary (value len s) 6280 6290 (declare (fixnum len)) 6281 6291 (unless (and (typep s 'basic-stream) … … 6329 6339 (aref value #+little-endian-target n #+big-endian-target (the fixnum (logxor n 3))))) 6330 6340 (incf idx)))))))) 6341 6342 (defmethod signed-integer-to-binary (value len (s vector-output-stream)) 6343 (%signed-integer-to-binary value len s)) 6331 6344 6332 6345 (defmethod signed-integer-to-binary (value len (s binary-output-stream)) 6346 (do* ((shift (ash (1- len) 3) (- shift 8))) 6347 ((< shift 0) value) 6348 (write-byte (logand #xff (ash value (- shift))) s))) 6333 6349 6334 6350 … … 6468 6484 6469 6485 6470 6471 (defun pui-stream (s count) 6486 (defmethod pui-stream ((s binary-input-stream) count) 6487 "Parse unsigned integer from a stream." 6488 (declare (fixnum count) ; any integer that cannot be expressed in fixnum bytes is probably (ahem) too long to worry about 6489 (optimize (speed 3) (safety 1) (debug 1))) 6490 (let ((n 0)) 6491 (dotimes (i count n) 6492 (declare (fixnum i)) 6493 (setq n (+ (the fixnum (read-byte s)) (the integer (ash n 8))))))) 6494 6495 (defun %pui-stream (s count) 6472 6496 (declare (fixnum count)) 6473 6497 (unless (and (typep s 'basic-stream) … … 6491 6515 result))) 6492 6516 6493 (defun psi-stream (s count) 6517 (defmethod pui-stream ((s vector-input-stream) count) 6518 (%pui-stream s count)) 6519 6520 (defmethod psi-stream ((s binary-input-stream) count) 6521 (declare (fixnum count)) 6522 (if (zerop count) 6523 0 6524 (let* ((n (read-byte s))) 6525 (if (>= n 128) 6526 (setq n (- n 256))) 6527 (dotimes (i (the fixnum (1- count)) n) 6528 (setq n (logior (read-byte s) (ash n 8))))))) 6529 6530 (defun %psi-stream (s count) 6494 6531 (declare (fixnum count)) 6495 6532 (unless (and (typep s 'basic-stream) … … 6512 6549 result))) 6513 6550 6551 (defmethod psi-stream ((s vector-input-stream) count) 6552 (%psi-stream s count)) 6553 6514 6554 (defmethod stream-position ((s vector-input-stream) &optional newpos) 6515 6555 (let* ((ioblock (basic-stream-ioblock s))
Note:
See TracChangeset
for help on using the changeset viewer.
