Skip to content

Commit

Permalink
fix Bool
Browse files Browse the repository at this point in the history
  • Loading branch information
Moelf committed Oct 10, 2022
1 parent ccb6c6c commit e67a12b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/UnROOT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ Base.seek(io::OffsetBuffer, i) = Base.seek(io.io, i - io.offset)
Base.skip(io::OffsetBuffer, i) = Base.skip(io.io, i)
Base.position(io::OffsetBuffer) = position(io.io) + io.offset

@static if VERSION < v"1.7"
function unsafe_arraycastntoh(::Type{D}, ary::Vector{S}) where {S, D}
ntoh.(reinterpret(D, ary))
end
else
function unsafe_arraycastntoh(::Type{D}, ary::Vector{S}) where {S, D}
function unsafe_arraycastntoh(::Type{D}, ary::Vector{S}) where {S, D}
@static if VERSION < v"1.7"
res = reinterpret(D, ary)
D == Bool && return res
return ntoh.(res)
else
l = sizeof(S)*length(ary)÷sizeof(D)
res = ccall(:jl_reshape_array, Vector{D}, (Any, Any, Any), Vector{D}, ary, (l,))
@. res = ntoh(res)
res
return res
end
end

Expand Down

0 comments on commit e67a12b

Please sign in to comment.