Skip to content
This repository was archived by the owner on Sep 27, 2021. It is now read-only.

Commit 72c2000

Browse files
committed
add shorthands
1 parent 1160718 commit 72c2000

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/array.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ size(x::CLArray) = Int.(x.size)
2424
pointer(x::CLArray) = x.ptr
2525
context(p::CLArray) = context(pointer(p))
2626

27+
# Avoid conflict with OpenCL.cl
28+
module Shorthands
29+
using ..CLArrays
30+
cl(x) = x
31+
cl(x::CLArrays.CLArray) = x
32+
cl(xs::AbstractArray) = isbits(xs) ? xs : CLArrays.CLArray(xs)
33+
end
34+
2735
function (::Type{CLArray{T, N}})(size::NTuple{N, Integer}, ctx = global_context()) where {T, N}
2836
# element type has different padding from cl type in julia
2937
# for fixedsize arrays we use vload/vstore, so we can use it packed

0 commit comments

Comments
 (0)