Path: ...!weretis.net!feeder6.news.weretis.net!4.us.feeder.erje.net!3.eu.feeder.erje.net!feeder.erje.net!usenet.goja.nl.eu.org!aioe.org!7AktqsUqy5CCvnKa3S0Dkw.user.46.165.242.75.POSTED!not-for-mail
From: dxforth <dxforth@gmail.com>
Newsgroups: comp.lang.forth
Subject: Re: Efficient CMOVE
Date: Thu, 2 Sep 2021 21:50:08 +1000
Organization: Aioe.org NNTP Server
Message-ID: <sgqdpg$1jsg$1@gioia.aioe.org>
References: <sghpg8$1sh6$1@gioia.aioe.org> <sgiipl$bbc$1@dont-email.me>
 <sgiouu$k89$1@dont-email.me> <612d0520$0$705$14726298@news.sunsite.dk>
 <sgj7q8$t36$1@dont-email.me> <87mtoytul6.fsf@nightsong.com>
 <sgjuci$7hb$1@dont-email.me> <2021Aug31.091034@mips.complang.tuwien.ac.at>
 <sgl7dk$6q5$1@dont-email.me> <2021Aug31.181205@mips.complang.tuwien.ac.at>
 <sgo4qk$ton$1@dont-email.me> <2021Sep1.175835@mips.complang.tuwien.ac.at>
 <2021Sep1.233440@mips.complang.tuwien.ac.at>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: gioia.aioe.org; logging-data="53136"; posting-host="7AktqsUqy5CCvnKa3S0Dkw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101
 Thunderbird/78.13.0
Content-Language: en-GB
X-Notice: Filtered by postfilter v. 0.9.2
Bytes: 1898
Lines: 12

On 2/09/2021 07:34, Anton Ertl wrote:
> 
> Eliminating the locals is left as an exercise to the puristic readers.

: propagate ( afrom ato u -- )
   >r  swap ( ato afrom) 2dup - r@ u< if  \ overlapping case
     tuck ( ato afrom) -  r@ ( u) over +  begin ( u1) >r
       over ( afrom) dup 2 pick + 2 pick r@ over - min move
       2*  r>  over r@ ( u) u< not
     until  r> 2drop 2drop
   else  \ the usual non-pattern case
     r> ( ato afrom u) move
   then ;