aboutsummaryrefslogtreecommitdiff
path: root/examples/fib.fwd
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2025-03-17 21:49:25 +0200
committerKimplul <kimi.h.kuparinen@gmail.com>2025-03-17 21:49:25 +0200
commit17c7dbd9cec96862384c4323a0e36eb0558b580d (patch)
tree38edfb87113bc51bca0a6e97b085c30a60cd81e4 /examples/fib.fwd
parentf9c5985ce715cb2b353d87a19fed71d9904b60ed (diff)
downloadfwd-17c7dbd9cec96862384c4323a0e36eb0558b580d.tar.gz
fwd-17c7dbd9cec96862384c4323a0e36eb0558b580d.zip
fix some total moves
Diffstat (limited to 'examples/fib.fwd')
-rw-r--r--examples/fib.fwd8
1 files changed, 3 insertions, 5 deletions
diff --git a/examples/fib.fwd b/examples/fib.fwd
index 9bc5474..7084b9d 100644
--- a/examples/fib.fwd
+++ b/examples/fib.fwd
@@ -5,13 +5,11 @@
fib(int n, (int) res)
{
- fwd_copy(n) => int n1, int n2;
- if n1 < 2 {
+ if n < 2 {
res(1);
} else {
- fwd_copy(n2) => int n3, int n4;
- fib(n3 - 1) => int f1;
- fib(n4 - 2) => int f2;
+ fib(n - 1) => int f1;
+ fib(n - 2) => int f2;
res(f1 + f2);
}
}