! Copyright (C) 2005, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
-USING: accessors arrays assocs combinators growable.private
+USING: accessors arrays assocs growable.private
hashtables kernel kernel.private math math.order math.private
sequences sequences.private vectors ;
IN: sorting
: r-done? ( merge -- ? ) [ from2>> ] [ to2>> ] bi eq? ; inline
: dump-l ( merge -- )
- {
- [ accum>> ]
- [ [ to1>> ] [ from1>> fixnum-fast ] [ accum>> length integer>fixnum-strict ] tri [ fixnum+fast >>length ] 2keep ]
- [ seq>> ]
- [ from1>> roll dupd fixnum+fast ]
- } cleave seq-copy-loop drop ; inline
+ [ accum>> ] keep
+ [ [ to1>> ] [ from1>> fixnum-fast ] [ accum>> length integer>fixnum-strict ] tri [ fixnum+fast >>length ] 2keep ]
+ [ seq>> ]
+ [ from1>> roll dupd fixnum+fast ] tri
+ seq-copy-loop drop ; inline
: dump-r ( merge -- )
- {
- [ accum>> ]
- [ [ to2>> ] [ from2>> fixnum-fast ] [ accum>> length integer>fixnum-strict ] tri [ fixnum+fast >>length ] 2keep ]
- [ seq>> ]
- [ from2>> roll dupd fixnum+fast ]
- } cleave seq-copy-loop drop ; inline
+ [ accum>> ] keep
+ [ [ to2>> ] [ from2>> fixnum-fast ] [ accum>> length integer>fixnum-strict ] tri [ fixnum+fast >>length ] 2keep ]
+ [ seq>> ]
+ [ from2>> roll dupd fixnum+fast ] tri
+ seq-copy-loop drop ; inline
: l-next ( merge -- )
[ l-elt ] [ [ 1 + ] change-from1 accum>> ] bi push-unsafe ; inline