@@ -73,8 +73,15 @@ Base.:(==)(x::CuPtr, y::CuPtr) = UInt(x) == UInt(y)
73
73
Base.:(< )(x:: CuPtr , y:: CuPtr ) = UInt (x) < UInt (y)
74
74
Base.:(- )(x:: CuPtr , y:: CuPtr ) = UInt (x) - UInt (y)
75
75
76
+ if VERSION >= v " 1.12.0-DEV.225"
77
+ Base.:(+ )(x:: CuPtr{T} , y:: Integer ) where T =
78
+ reinterpret (CuPtr{T}, Base. add_ptr (reinterpret (Ptr{T}, x), (y % UInt) % UInt))
79
+ Base.:(- )(x:: CuPtr{T} , y:: Integer ) where T =
80
+ reinterpret (CuPtr{T}, Base. sub_ptr (reinterpret (Ptr{T}, x), (y % UInt) % UInt))
81
+ else
76
82
Base.:(+ )(x:: CuPtr , y:: Integer ) = oftype (x, Base. add_ptr (UInt (x), (y % UInt) % UInt))
77
83
Base.:(- )(x:: CuPtr , y:: Integer ) = oftype (x, Base. sub_ptr (UInt (x), (y % UInt) % UInt))
84
+ end
78
85
Base.:(+ )(x:: Integer , y:: CuPtr ) = y + x
79
86
80
87
@@ -186,8 +193,15 @@ Base.:(==)(x::CuArrayPtr, y::CuArrayPtr) = UInt(x) == UInt(y)
186
193
Base.:(< )(x:: CuArrayPtr , y:: CuArrayPtr ) = UInt (x) < UInt (y)
187
194
Base.:(- )(x:: CuArrayPtr , y:: CuArrayPtr ) = UInt (x) - UInt (y)
188
195
196
+ if VERSION >= v " 1.12.0-DEV.225"
197
+ Base.:(+ )(x:: CuArrayPtr{T} , y:: Integer ) where T =
198
+ reinterpret (CuArrayPtr{T}, Base. add_ptr (reinterpret (Ptr{T}, x), (y % UInt) % UInt))
199
+ Base.:(- )(x:: CuArrayPtr{T} , y:: Integer ) where T =
200
+ reinterpret (CuArrayPtr{T}, Base. sub_ptr (reinterpret (Ptr{T}, x), (y % UInt) % UInt))
201
+ else
189
202
Base.:(+ )(x:: CuArrayPtr , y:: Integer ) = oftype (x, Base. add_ptr (UInt (x), (y % UInt) % UInt))
190
203
Base.:(- )(x:: CuArrayPtr , y:: Integer ) = oftype (x, Base. sub_ptr (UInt (x), (y % UInt) % UInt))
204
+ end
191
205
Base.:(+ )(x:: Integer , y:: CuArrayPtr ) = y + x
192
206
193
207
0 commit comments