epsilon-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Jitter: new stack primitive: tuck [Was: Re: Jitter: new stack primitive


From: Luca Saiu
Subject: Jitter: new stack primitive: tuck [Was: Re: Jitter: new stack primitive (or micro-primitive): quake]
Date: Mon, 25 Nov 2019 04:50:17 +0100
User-agent: Gnus (Gnus v5.13), GNU Emacs 27.0.50, x86_64-pc-linux-gnu

On 2019-11-25 at 03:58 +0100, Luca Saiu wrote:

> I have added a new stack operation [...]

And now another, which you might also like since you juggle a lot with
stacks.

"tuck" is a kind of slightly counterintuitive dual of over, which leaves
a copy of the current top, without destroying it, in the under-under-top
position, moving under-top and top up by one position.

It is standard in Forth, with effect
  ( a b -- b a b )

Of course it would be possible to define tuck as
  : tuck swap over ;
but the native version is much faster, particularly on a TOS-optimized stack.

Example:

1 2 .s
  <2> 1 2
tuck .s
  <3> 2 1 2

Regards,

-- 
Luca Saiu
* My personal web site:  http://ageinghacker.net
* GNU epsilon:           http://www.gnu.org/software/epsilon
* Jitter:                http://ageinghacker.net/projects/jitter

I support everyone's freedom of mocking any opinion or belief, no
matter how deeply held, with open disrespect and the same unrelented
enthusiasm of a toddler who has just learned the word "poo".

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]