Skip to content

Commit 5e8c149

Browse files
authored
Fix OpenCL on 1.12 (#333)
1 parent d65f049 commit 5e8c149

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/cl/pointer.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,15 @@ Base.:(==)(x::CLPtr, y::CLPtr) = UInt(x) == UInt(y)
7171
Base.:(<)(x::CLPtr, y::CLPtr) = UInt(x) < UInt(y)
7272
Base.:(-)(x::CLPtr, y::CLPtr) = UInt(x) - UInt(y)
7373

74+
if VERSION >= v"1.12.0-DEV.225"
75+
Base.:(+)(x::CLPtr{T}, y::Integer) where T =
76+
reinterpret(CLPtr{T}, Base.add_ptr(reinterpret(Ptr{T}, x), (y % UInt) % UInt))
77+
Base.:(-)(x::CLPtr{T}, y::Integer) where T =
78+
reinterpret(CLPtr{T}, Base.sub_ptr(reinterpret(Ptr{T}, x), (y % UInt) % UInt))
79+
else
7480
Base.:(+)(x::CLPtr, y::Integer) = oftype(x, Base.add_ptr(UInt(x), (y % UInt) % UInt))
7581
Base.:(-)(x::CLPtr, y::Integer) = oftype(x, Base.sub_ptr(UInt(x), (y % UInt) % UInt))
82+
end
7683
Base.:(+)(x::Integer, y::CLPtr) = y + x
7784

7885

0 commit comments

Comments
 (0)