From: Tim Vaughan Date: Tue, 26 Apr 2016 09:37:48 +0000 (+1200) Subject: Added 2* and 2/ arithmetic bit shift words. X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=commitdiff_plain;h=231d418c3abbf3c1cf08742e7634a6728714b30a;p=forth.jl.git Added 2* and 2/ arithmetic bit shift words. --- diff --git a/src/forth.jl b/src/forth.jl index 99d9451..11d0044 100644 --- a/src/forth.jl +++ b/src/forth.jl @@ -351,6 +351,16 @@ DIVMOD = defPrimWord("/MOD", () -> begin return NEXT end) +TWOMUL = defPrimWord("2*", () -> begin + pushPS(popPS() << 1) + return NEXT +end) + +TWODIV = defPrimWord("2/", () -> begin + pushPS(popPS() >> 1) + return NEXT +end) + EQU = defPrimWord("=", () -> begin b = popPS() a = popPS()