3 ms·
I am not sure about that insightful. He complains that literals on the F21 take two instructions. The Forth way is to define constants you need often like this:
by Someone 16y ago
I am not sure about that insightful. He complains that literals on the F21 take two instructions. The Forth way is to define constants you need often like this:
: 1 1 ;
(that denies a function called 1 that 'returns' the integer 1)
With that function in place (3 instructions, I guess), you can replace n usages of the literal 1 (2n instructions) by n calls of that function (n instructions), for a total of n+3 instructions. So, this pays of if n>=3.
Oh, and subroutine calls are cheap on Forth hardware (one cycle for a call and zero cycles for a return is easily achievable)