]> gitweb.factorcode.org Git - factor.git/commitdiff
byte-vectors: dos2unix
authorDoug Coleman <doug.coleman@gmail.com>
Fri, 31 Oct 2014 07:45:51 +0000 (00:45 -0700)
committerDoug Coleman <doug.coleman@gmail.com>
Fri, 31 Oct 2014 07:45:51 +0000 (00:45 -0700)
core/byte-vectors/byte-vectors.factor

index 54f464a9dc6adacac2369a9f9bf3b054a5e2ee0b..815ecbc53cc6c271f1397915dd07c7cab8c3d262 100644 (file)
@@ -1,48 +1,48 @@
-! Copyright (C) 2008 Slava Pestov.\r
-! See http://factorcode.org/license.txt for BSD license.\r
-USING: accessors byte-arrays growable kernel math sequences\r
-sequences.private ;\r
-IN: byte-vectors\r
-\r
-TUPLE: byte-vector\r
-{ underlying byte-array }\r
-{ length array-capacity } ;\r
-\r
-: <byte-vector> ( n -- byte-vector )\r
-    (byte-array) 0 byte-vector boa ; inline\r
-\r
-: >byte-vector ( seq -- byte-vector )\r
-    >byte-array dup length byte-vector boa ;\r
-\r
-M: byte-vector like\r
-    drop dup byte-vector? [\r
-        dup byte-array?\r
-        [ dup length byte-vector boa ] [ >byte-vector ] if\r
-    ] unless ; inline\r
-\r
-M: byte-vector new-sequence\r
-    drop [ (byte-array) ] [ >fixnum ] bi byte-vector boa ; inline\r
-\r
-M: byte-vector equal?\r
-    over byte-vector? [ sequence= ] [ 2drop f ] if ;\r
-\r
-M: byte-vector contract 2drop ; inline\r
-\r
-M: byte-array like\r
-    #! If we have an byte-array, we're done.\r
-    #! If we have a byte-vector, and it's at full capacity,\r
-    #! we're done. Otherwise, call resize-byte-array, which is a\r
-    #! relatively fast primitive.\r
-    drop dup byte-array? [\r
-        dup byte-vector? [\r
-            [ length ] [ underlying>> ] bi\r
-            2dup length eq?\r
-            [ nip ] [ resize-byte-array ] if\r
-        ] [ >byte-array ] if\r
-    ] unless ; inline\r
-\r
-M: byte-array new-resizable drop <byte-vector> ; inline\r
-\r
-M: byte-vector new-resizable drop <byte-vector> ; inline\r
-\r
-INSTANCE: byte-vector growable\r
+! Copyright (C) 2008 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+USING: accessors byte-arrays growable kernel math sequences
+sequences.private ;
+IN: byte-vectors
+
+TUPLE: byte-vector
+{ underlying byte-array }
+{ length array-capacity } ;
+
+: <byte-vector> ( n -- byte-vector )
+    (byte-array) 0 byte-vector boa ; inline
+
+: >byte-vector ( seq -- byte-vector )
+    >byte-array dup length byte-vector boa ;
+
+M: byte-vector like
+    drop dup byte-vector? [
+        dup byte-array?
+        [ dup length byte-vector boa ] [ >byte-vector ] if
+    ] unless ; inline
+
+M: byte-vector new-sequence
+    drop [ (byte-array) ] [ >fixnum ] bi byte-vector boa ; inline
+
+M: byte-vector equal?
+    over byte-vector? [ sequence= ] [ 2drop f ] if ;
+
+M: byte-vector contract 2drop ; inline
+
+M: byte-array like
+    #! If we have an byte-array, we're done.
+    #! If we have a byte-vector, and it's at full capacity,
+    #! we're done. Otherwise, call resize-byte-array, which is a
+    #! relatively fast primitive.
+    drop dup byte-array? [
+        dup byte-vector? [
+            [ length ] [ underlying>> ] bi
+            2dup length eq?
+            [ nip ] [ resize-byte-array ] if
+        ] [ >byte-array ] if
+    ] unless ; inline
+
+M: byte-array new-resizable drop <byte-vector> ; inline
+
+M: byte-vector new-resizable drop <byte-vector> ; inline
+
+INSTANCE: byte-vector growable