redefine 2CONSTANT in terms of CREATE DOES>, saving two cells per use

This commit is contained in:
Jesse D. McDonald 2020-10-27 16:59:00 -05:00
parent 687012b7df
commit 1ceedba773
1 changed files with 2 additions and 1 deletions

View File

@ -1255,7 +1255,8 @@ DEFER REFILL
: CONSTANT CREATE LATEST >DFA ! ; : CONSTANT CREATE LATEST >DFA ! ;
\ Same for double-cell constants; no DFA trick this time \ Same for double-cell constants; no DFA trick this time
: 2CONSTANT : POSTPONE 2LITERAL POSTPONE ; ; : 2CONSTANT ( x1 x2 -- ) CREATE HERE 2 CELLS ALLOT 2!
DOES> ( -- x1 x2 ) 2@ ;
\ Define a single-cell named variable which returns its data address when executed. \ Define a single-cell named variable which returns its data address when executed.
\ The initial value is formally undefined. This implementation sets it to NULL. \ The initial value is formally undefined. This implementation sets it to NULL.