Skip to content

Commit a83cac6

Browse files
authored
Merge pull request #355 from tkoolen/tk/pointer_from_objref
Adapt to Base.data_pointer_from_objref removal
2 parents 9044eb2 + 7abda78 commit a83cac6

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

src/MArray.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ end
9898

9999
T = eltype(v)
100100
if isbits(T)
101-
unsafe_store!(Base.unsafe_convert(Ptr{T}, Base.data_pointer_from_objref(v)), convert(T, val), i)
101+
unsafe_store!(Base.unsafe_convert(Ptr{T}, pointer_from_objref(v)), convert(T, val), i)
102102
else
103103
# This one is unsafe (#27)
104-
# unsafe_store!(Base.unsafe_convert(Ptr{Ptr{Void}}, Base.data_pointer_from_objref(v.data)), Base.data_pointer_from_objref(val), i)
104+
# unsafe_store!(Base.unsafe_convert(Ptr{Ptr{Void}}, pointer_from_objref(v.data)), pointer_from_objref(val), i)
105105
error("setindex!() with non-isbits eltype is not supported by StaticArrays. Consider using SizedArray.")
106106
end
107107

@@ -111,7 +111,7 @@ end
111111
@inline Tuple(v::MArray) = v.data
112112

113113
@inline function Base.unsafe_convert(::Type{Ptr{T}}, a::MArray{S,T}) where {S,T}
114-
Base.unsafe_convert(Ptr{T}, Base.data_pointer_from_objref(a))
114+
Base.unsafe_convert(Ptr{T}, pointer_from_objref(a))
115115
end
116116

117117
macro MArray(ex)

src/MMatrix.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ show(io::IO, ::Type{MMatrix{N, M, T}}) where {N, M, T} = print(io, "MMatrix{$N,$
7474

7575
# This is nasty... but it turns out Julia will literally copy the whole tuple to the stack otherwise!
7676
if isbits(T)
77-
unsafe_load(Base.unsafe_convert(Ptr{T}, Base.data_pointer_from_objref(m)), i)
77+
unsafe_load(Base.unsafe_convert(Ptr{T}, pointer_from_objref(m)), i)
7878
else
7979
# Not sure about this... slow option for now...
8080
m.data[i]
81-
#unsafe_load(Base.unsafe_convert(Ptr{Ptr{Void}}, Base.data_pointer_from_objref(m.data)), i)
81+
#unsafe_load(Base.unsafe_convert(Ptr{Ptr{Void}}, pointer_from_objref(m.data)), i)
8282
end
8383
end
8484

@@ -89,10 +89,10 @@ end
8989
#end
9090

9191
if isbits(T)
92-
unsafe_store!(Base.unsafe_convert(Ptr{T}, Base.data_pointer_from_objref(m)), val, i)
92+
unsafe_store!(Base.unsafe_convert(Ptr{T}, pointer_from_objref(m)), val, i)
9393
else # TODO check that this isn't crazy. Also, check it doesn't cause problems with GC...
9494
# This one is unsafe (#27)
95-
# unsafe_store!(Base.unsafe_convert(Ptr{Ptr{Void}}, Base.data_pointer_from_objref(m.data)), Base.data_pointer_from_objref(val), i)
95+
# unsafe_store!(Base.unsafe_convert(Ptr{Ptr{Void}}, pointer_from_objref(m.data)), pointer_from_objref(val), i)
9696
error("setindex!() with non-isbits eltype is not supported by StaticArrays. Consider using SizedArray.")
9797
end
9898

src/MVector.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ end
4343
end
4444

4545
if isbits(T)
46-
unsafe_store!(Base.unsafe_convert(Ptr{T}, Base.data_pointer_from_objref(v)), val, i)
46+
unsafe_store!(Base.unsafe_convert(Ptr{T}, pointer_from_objref(v)), val, i)
4747
else
4848
# This one is unsafe (#27)
49-
#unsafe_store!(Base.unsafe_convert(Ptr{Ptr{Void}}, Base.data_pointer_from_objref(v.data)), Base.data_pointer_from_objref(val), i)
49+
#unsafe_store!(Base.unsafe_convert(Ptr{Ptr{Void}}, pointer_from_objref(v.data)), pointer_from_objref(val), i)
5050
error("setindex!() with non-isbits eltype is not supported by StaticArrays. Consider using SizedArray.")
5151
end
5252

src/util.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ TrivialView(a::AbstractArray{T,N}) where {T,N} = TrivialView{typeof(a),T,N}(a)
8080
# See https://github.com/JuliaLang/julia/issues/23826
8181
# """
8282
# drop_sdims(a)
83-
#
83+
#
8484
# Return an `AbstractArray` with the same elements as `a`, but with static
8585
# dimensions removed (ie, not a `StaticArray`).
86-
#
86+
#
8787
# This is useful if you want to override dispatch to call the `Base` version of
8888
# operations such as `kron` instead of the implementation in `StaticArrays`.
8989
# Normally you shouldn't need to do this, but it can be more efficient for

0 commit comments

Comments
 (0)