Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/strings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@ struct PointerString <: AbstractString
end

function Base.hash(s::PointerString, h::UInt)
h += Base.memhash_seed
ccall(Base.memhash, UInt, (Ptr{UInt8}, Csize_t, UInt32), s.ptr, s.len, h % UInt32) + h
@static if isdefined(Base, :hash_bytes)
GC.@preserve s.ptr Base.hash_bytes(s.ptr, s.len, UInt64(h), Base.HASH_SECRET) % UInt
else
h += Base.memhash_seed
ccall(Base.memhash, UInt, (Ptr{UInt8}, Csize_t, UInt32), s.ptr, s.len, h % UInt32) + h
end
end

import Base: ==
Expand Down