The Lambda Lab
/
projects
/
forth.jl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1a8bb25
)
Added 2* and 2/ arithmetic bit shift words.
author
Tim Vaughan
<tgvaughan@gmail.com>
Tue, 26 Apr 2016 09:37:48 +0000
(21:37 +1200)
committer
Tim Vaughan
<tgvaughan@gmail.com>
Tue, 26 Apr 2016 09:37:48 +0000
(21:37 +1200)
src/forth.jl
patch
|
blob
|
history
diff --git
a/src/forth.jl
b/src/forth.jl
index
99d9451
..
11d0044
100644
(file)
--- 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()