@@ -42,21 +42,23 @@ preprocess_args(f::typeof(diffeqbc), dest, args::Tuple{}) = ()
42
42
43
43
# Performance optimization for the common identity scalar case: dest .= val
44
44
@inline copyto! (dest:: DiffEqBC , bc:: Broadcasted{<:AbstractArrayStyle{0}} ) = copyto! (dest. x, bc)
45
- @inline function copyto! (dest:: DiffEqBC , bc:: Broadcasted )
46
- axes (dest) == axes (bc) || throwdm (axes (dest), axes (bc))
47
- dest′ = dest. x
48
- # Performance optimization: broadcast!(identity, dest, A) is equivalent to copyto!(dest, A) if indices match
49
- if bc. f === identity && bc. args isa Tuple{AbstractArray} # only a single input argument to broadcast!
50
- A = bc. args[1 ]
51
- if axes (dest) == axes (A)
52
- return copyto! (dest′, A)
53
- end
54
- end
55
- bcs′ = preprocess (diffeqbc, dest, bc)
56
- @simd ivdep for I in eachindex (bcs′)
57
- @inbounds dest′[I] = bcs′[I]
58
- end
59
- return dest′ # return the original array without the wrapper
45
+ for B in (Broadcasted, Broadcasted{<: StaticArrays.StaticArrayStyle }) # fix ambiguity
46
+ @eval @inline function copyto! (dest:: DiffEqBC , bc:: $B )
47
+ axes (dest) == axes (bc) || throwdm (axes (dest), axes (bc))
48
+ dest′ = dest. x
49
+ # Performance optimization: broadcast!(identity, dest, A) is equivalent to copyto!(dest, A) if indices match
50
+ if bc. f === identity && bc. args isa Tuple{AbstractArray} # only a single input argument to broadcast!
51
+ A = bc. args[1 ]
52
+ if axes (dest) == axes (A)
53
+ return copyto! (dest′, A)
54
+ end
55
+ end
56
+ bcs′ = preprocess (diffeqbc, dest, bc)
57
+ @simd ivdep for I in eachindex (bcs′)
58
+ @inbounds dest′[I] = bcs′[I]
59
+ end
60
+ return dest′ # return the original array without the wrapper
61
+ end
60
62
end
61
63
62
64
# Forcing `broadcasted` to inline is not necessary, since `Vern9` plays well
0 commit comments