forked from Mirrors/wasm3
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
378 B
Plaintext
31 lines
378 B
Plaintext
(module
|
|
(export "fib" (func $fib))
|
|
(func $fib (param $n i32) (result i32)
|
|
(if
|
|
(i32.lt_u
|
|
(get_local $n)
|
|
(i32.const 2)
|
|
)
|
|
(return
|
|
(get_local $n)
|
|
)
|
|
)
|
|
(return
|
|
(i32.add
|
|
(call $fib
|
|
(i32.sub
|
|
(get_local $n)
|
|
(i32.const 2)
|
|
)
|
|
)
|
|
(call $fib
|
|
(i32.sub
|
|
(get_local $n)
|
|
(i32.const 1)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|
|
)
|