aboutsummaryrefslogtreecommitdiff
path: root/tests/fibonacci.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tests/fibonacci.lua')
-rw-r--r--tests/fibonacci.lua9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/fibonacci.lua b/tests/fibonacci.lua
index 48cd8d7..a5e0b2a 100644
--- a/tests/fibonacci.lua
+++ b/tests/fibonacci.lua
@@ -28,6 +28,7 @@ local KNOWN= { [0]=0, 1,1,2,3,5,8,13,21,34,55,89,144 }
28-- uint= fib( n_uint ) 28-- uint= fib( n_uint )
29-- 29--
30local function fib( n ) 30local function fib( n )
31 --local lanes = require"lanes".configure()
31 -- 32 --
32 local sum 33 local sum
33 local floor= assert(math.floor) 34 local floor= assert(math.floor)
@@ -39,9 +40,11 @@ local function fib( n )
39 else 40 else
40 -- Splits into two; this task remains waiting for the results 41 -- Splits into two; this task remains waiting for the results
41 -- 42 --
42 -- note that lanes is pulled in as upvalue, so we need package library to require internals properly 43 -- note that lanes is pulled in by upvalue, so we need lanes.core to be available
43 -- (because lua51-lanes is always required internally if possible, which is necessary in that case) 44 -- the other solution is to require "lanes" from inside the lane body, as in:
44 local gen_f= lanes.gen( "*", fib ) 45 -- local lanes = require"lanes".configure()
46 -- local gen_f= lanes.gen( "*", fib)
47 local gen_f= lanes.gen( "*", {required={"lanes.core"}}, fib)
45 48
46 local n1=floor(n/2) +1 49 local n1=floor(n/2) +1
47 local n2=floor(n/2) -1 + n%2 50 local n2=floor(n/2) -1 + n%2