Added 2* and 2/ arithmetic bit shift words.
authorTim Vaughan <tgvaughan@gmail.com>
Tue, 26 Apr 2016 09:37:48 +0000 (21:37 +1200)
committerTim Vaughan <tgvaughan@gmail.com>
Tue, 26 Apr 2016 09:37:48 +0000 (21:37 +1200)
src/forth.jl

index 99d9451..11d0044 100644 (file)
@@ -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()