2010-04-19 02:13:21 -04:00
|
|
|
! Copyright (C) 2010 Slava Pestov.
|
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2019-05-19 21:47:34 -04:00
|
|
|
USING: alien byte-arrays byte-vectors io kernel libc math
|
|
|
|
sequences ;
|
2010-04-19 02:13:21 -04:00
|
|
|
IN: io.streams.byte-array.fast
|
|
|
|
|
|
|
|
! This is split off from io.streams.byte-array because it uses
|
|
|
|
! memcpy, which is a non-core word that only works after the
|
|
|
|
! optimizing compiler has been loaded.
|
|
|
|
|
|
|
|
M: byte-vector stream-write
|
2019-05-19 21:47:34 -04:00
|
|
|
over byte-array? [
|
|
|
|
push-all ! faster than memcpy
|
|
|
|
] [
|
|
|
|
2dup [ byte-length ] bi@
|
|
|
|
3dup + swap lengthen
|
|
|
|
[ tail-slice swap ] curry dip memcpy
|
|
|
|
] if ;
|