Am Sonntag, 10. November 2013, 03:15:59 schrieb Marcos Cruz:
> I've realized '+place' is defined in two different files and ways.  'see
> +place' shows the actual definition is that of <cross.fs>; the second
> 
> definition is in <other.fs>:
> : +place ( adr len adr )
> 
>         2dup c@ + over c!
>         dup c@ char+ + swap move ;
> 
> I discovered it doesn't work fine.

Yes, that's broken.  It first updates the count and then uses the updated 
count...  apparently nobody uses +PLACE, except in cross (which is the reason 
why the definition there works ;-).

> At first sight the fixed definition of <other.fs> seems faster, with
> 
> less stack operations:
> : +place ( ca1 len1 ca2 )
> 
>   2dup c@ dup >r  + over c!  r> char+ +  swap move
>   ;

Yes, this works.  Fixed.

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
http://bernd-paysan.de/

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to