Skip to content

Commit 697c2ae

Browse files
committed
Update
1 parent d67bb62 commit 697c2ae

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/Nonlinear/ReverseAD/utils.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ end
4848

4949
Base.getindex(x::_UnsafeVectorView, i::CartesianIndex{1}) = getindex(x, i[1])
5050

51-
function Base.setindex!(x::_UnsafeVectorView{T}, value::T, i::Integer) where {T}
51+
function Base.setindex!(x::_UnsafeVectorView, value, i::Integer)
52+
# We don't need to worry about `value` being the right type here because
53+
# x.ptr is a `::Ptr{T}`, so even though it is called `unsafe_store!`, there
54+
# is still a type convertion that happens so that we're not just chucking
55+
# the bits of value into `x.ptr`.
5256
unsafe_store!(x.ptr, value, i + x.offset)
5357
return value
5458
end
5559

56-
function Base.setindex!(x::_UnsafeVectorView{T}, value, i::Integer) where {T}
57-
return setindex!(x, convert(T, value), i)
58-
end
59-
6060
function Base.setindex!(x::_UnsafeVectorView, value, i::CartesianIndex{1})
6161
return setindex!(x, value, i[1])
6262
end

0 commit comments

Comments
 (0)