Skip to content

Commit 0fec6fe

Browse files
committed
fix test because mutating bindings captured by closures shouldn't be a thing that exists
1 parent b13e9ee commit 0fec6fe

File tree

1 file changed

+26
-25
lines changed

1 file changed

+26
-25
lines changed

test/ifelsemasks.jl

+26-25
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ T = Float32
319319
end
320320

321321
function twoifelses!(res, half, m, keep = nothing, final = true)
322-
𝒶𝓍j = axes(half, 1)
322+
local 𝒶𝓍j = axes(half, 1)
323323
for j in 𝒶𝓍j
324324
𝓇𝒽𝓈 = if isnothing(keep)
325325
log(half[j]) + m[j]
@@ -331,7 +331,7 @@ T = Float32
331331
res
332332
end
333333
function twoifelses_avx!(res, half, m, keep = nothing, final = true)
334-
𝒶𝓍j = axes(half, 1)
334+
local 𝒶𝓍j = axes(half, 1)
335335
@turbo for j in 𝒶𝓍j
336336
𝓇𝒽𝓈 = if isnothing(keep)
337337
log(half[j]) + m[j]
@@ -363,9 +363,9 @@ T = Float32
363363

364364
chebpts(m) = (n = m - 1; [cos(k * pi / n) for k = 0:n])
365365
function barycentric_weight0(X)
366-
T = eltype(X)
367-
n = length(X) - 1
368-
w = zero(X)
366+
local T = eltype(X)
367+
local n = length(X) - 1
368+
local w = zero(X)
369369
@inbounds @fastmath for j = 0:n
370370
tmp = one(T)
371371
for k = 0:n
@@ -376,9 +376,9 @@ T = Float32
376376
return w
377377
end
378378
function barycentric_weight1(X)
379-
T = eltype(X)
380-
n = length(X) - 1
381-
w = zero(X)
379+
local T = eltype(X)
380+
local n = length(X) - 1
381+
local w = zero(X)
382382
@turbo for j = 0:n
383383
tmp = one(T)
384384
for k = 0:n
@@ -389,9 +389,9 @@ T = Float32
389389
return w
390390
end
391391
function barycentric_weight2(X)
392-
T = eltype(X)
393-
n = length(X) - 1
394-
w = zero(X)
392+
local T = eltype(X)
393+
local n = length(X) - 1
394+
local w = zero(X)
395395
@turbo inline = true for j = 0:n
396396
tmp = one(T)
397397
for k = 0:n
@@ -402,9 +402,9 @@ T = Float32
402402
return w
403403
end
404404
function barycentric_weight3(X)
405-
T = eltype(X)
406-
n = length(X) - 1
407-
w = zero(X)
405+
local T = eltype(X)
406+
local n = length(X) - 1
407+
local w = zero(X)
408408
@turbo inline = true for j = 0:n
409409
tmp = one(T)
410410
for k = 0:n
@@ -415,9 +415,9 @@ T = Float32
415415
return w
416416
end
417417
function barycentric_weight4(X)
418-
T = eltype(X)
419-
n = length(X) - 1
420-
w = zero(X)
418+
local T = eltype(X)
419+
local n = length(X) - 1
420+
local w = zero(X)
421421
@turbo for j = 0:n
422422
tmp = one(T)
423423
for k = 0:n
@@ -469,16 +469,16 @@ T = Float32
469469
end
470470

471471
function absmax_tturbo(a) # LV threaded
472-
result = zero(eltype(a))
472+
local result = zero(eltype(a))
473473
@tturbo for i = 1:length(a)
474474
abs(a[i]) > result && (result = abs(a[i]))
475475
end
476476
result
477477
end
478478

479479
function findminturbo(x)
480-
indmin = 0
481-
minval = typemax(eltype(x))
480+
local indmin = 0
481+
local minval = typemax(eltype(x))
482482
@turbo for i eachindex(x)
483483
newmin = x[i] < minval
484484
minval = newmin ? x[i] : minval
@@ -487,8 +487,8 @@ T = Float32
487487
minval, indmin
488488
end
489489
function findmintturbo(x)
490-
indmin = 0
491-
minval = typemax(eltype(x))
490+
local indmin = 0
491+
local minval = typemax(eltype(x))
492492
@tturbo for i eachindex(x)
493493
newmin = x[i] < minval
494494
minval = newmin ? x[i] : minval
@@ -497,8 +497,8 @@ T = Float32
497497
minval, indmin
498498
end
499499
function findminturbo_u4(x)
500-
indmin = 0
501-
minval = typemax(eltype(x))
500+
local indmin = 0
501+
local minval = typemax(eltype(x))
502502
@turbo unroll = 4 for i eachindex(x)
503503
newmin = x[i] < minval
504504
minval = newmin ? x[i] : minval
@@ -507,7 +507,8 @@ T = Float32
507507
minval, indmin
508508
end
509509
function extrema_turbo(x)
510-
a = b = first(x)
510+
local a = first(x)
511+
local b = a;
511512
@turbo for i in eachindex(x)
512513
local e = x[i]
513514
b = max(b, e)

0 commit comments

Comments
 (0)