Skip to content

Faster way for aliases of words? #52

Answered by tabemann
robzed asked this question in Q&A
Discussion options

You must be logged in to vote

For words that can themselves be inlined you can do, say,

: f+ [inlined] d+ ;
: f- [inlined] d- ;
: fdup [inlined] 2dup ;
: fswap [inlined] 2swap ;
: f! [inlined] 2! ;
: f@ [inlined] 2@ ;
: ei [inlined] enable-int ;
: di [inlined] disable-int ;

(I assume you accidentally swapped ei and di.)

Note that this cannot be done with words that are not inlinable, because calls to non-inlined words are inherently non-inlinable due to calls either PC-relative or calls require loading an address from a constant pool beforehand (which itself is PC-relative). In many cases zeptoforth is smart enough to ignore [inlined] if a word cannot be inlined, it should be noted, but if your code crashes instead, …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@robzed
Comment options

Answer selected by robzed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants