From 66e7ffa1b3e5638a1c788bce0ce293dcac9c4e1c Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 20 Feb 2023 21:17:13 -0600 Subject: [PATCH] sorting: still use --- core/growable/growable.factor | 4 ++++ core/sorting/sorting.factor | 16 ++++------------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/core/growable/growable.factor b/core/growable/growable.factor index 68c6678fae..05ed40c92f 100644 --- a/core/growable/growable.factor +++ b/core/growable/growable.factor @@ -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 (copy) drop ; inline + PRIVATE> : capacity ( seq -- n ) underlying>> length ; inline diff --git a/core/sorting/sorting.factor b/core/sorting/sorting.factor index 5be28184a8..832e067917 100644 --- a/core/sorting/sorting.factor +++ b/core/sorting/sorting.factor @@ -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 -- 2.34.1