]> gitweb.factorcode.org Git - factor.git/commitdiff
sorting: still use <copier>
authorDoug Coleman <doug.coleman@gmail.com>
Tue, 21 Feb 2023 03:17:13 +0000 (21:17 -0600)
committerDoug Coleman <doug.coleman@gmail.com>
Sun, 26 Feb 2023 23:11:04 +0000 (17:11 -0600)
core/growable/growable.factor
core/sorting/sorting.factor

index 68c6678fae520a82fdb20406f44c53c4648f6d14..05ed40c92f69d2424b379ac07ae2490393b6bd88 100644 (file)
@@ -19,6 +19,10 @@ M: growable set-nth-unsafe underlying>> set-nth-unsafe ; inline
     [ length integer>fixnum-strict ] keep
     [ set-nth-unsafe ] [ [ 1 fixnum+fast ] dip length<< ] 2bi ; inline
 
+: push-all-unsafe ( from to src dst -- )
+    [ over - swap ] 2dip pickd [ length integer>fixnum-strict ] keep
+    [ [ fixnum+fast ] dip length<< ] 2keep <copier> (copy) drop ; inline
+
 PRIVATE>
 
 : capacity ( seq -- n ) underlying>> length ; inline
index 5be28184a895aa2915ba6649c435c656097a8f48..832e067917eaf5e7dbfc05de19407bd5557c2f00 100644 (file)
@@ -33,20 +33,12 @@ TUPLE: merge-state
 : r-done? ( merge -- ? ) [ from2>> ] [ to2>> ] bi eq? ; inline
 
 : dump-l ( merge -- )
-    [ accum>> ] keep
-    [
-        [ to1>> ] [ from1>> fixnum-fast ] [ accum>> length integer>fixnum-strict ] tri
-        [ fixnum+fast >>length ] 2keep
-    ] [ seq>> ] [ from1>> roll dupd fixnum+fast ] tri
-    copy-loop drop ; inline
+    [ [ from1>> ] [ to1>> ] [ seq>> ] tri ] [ accum>> ] bi
+    push-all-unsafe ; inline
 
 : dump-r ( merge -- )
-    [ accum>> ] keep
-    [
-        [ to2>> ] [ from2>> fixnum-fast ] [ accum>> length integer>fixnum-strict ] tri
-        [ fixnum+fast >>length ] 2keep
-    ] [ seq>> ] [ from2>> roll dupd fixnum+fast ] tri
-    copy-loop drop ; inline
+    [ [ from2>> ] [ to2>> ] [ seq>> ] tri ] [ accum>> ] bi
+    push-all-unsafe ; inline
 
 : l-next ( merge -- )
     [ l-elt ] [ [ 1 + ] change-from1 accum>> ] bi push-unsafe ; inline