]> gitweb.factorcode.org Git - factor.git/blob - basis/io/streams/byte-array/fast/fast.factor
basis/extra: removing unnecessary IN: statements.
[factor.git] / basis / io / streams / byte-array / fast / fast.factor
1 ! Copyright (C) 2010 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: alien byte-arrays byte-vectors io kernel libc math
4 sequences ;
5
6 ! This is split off from io.streams.byte-array because it uses
7 ! memcpy, which is a non-core word that only works after the
8 ! optimizing compiler has been loaded.
9
10 M: byte-vector stream-write
11     over byte-array? [
12         push-all ! faster than memcpy
13     ] [
14         2dup [ byte-length ] bi@
15         3dup + swap lengthen
16         [ tail-slice swap ] curry dip memcpy
17     ] if ;