Skip to content

Commit 319d4f9

Browse files
Fix for newer Julia - Update strings.jl
1 parent cc047e0 commit 319d4f9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/strings.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ struct PointerString <: AbstractString
44
end
55

66
function Base.hash(s::PointerString, h::UInt)
7-
h += Base.memhash_seed
8-
ccall(Base.memhash, UInt, (Ptr{UInt8}, Csize_t, UInt32), s.ptr, s.len, h % UInt32) + h
7+
@static if isdefined(Base, :hash_bytes)
8+
GC.@preserve s.ptr Base.hash_bytes(s.ptr), s.len, UInt64(h), Base.HASH_SECRET) % UInt
9+
else
10+
h += Base.memhash_seed
11+
ccall(Base.memhash, UInt, (Ptr{UInt8}, Csize_t, UInt32), s.ptr, s.len, h % UInt32) + h
12+
end
913
end
1014

1115
import Base: ==

0 commit comments

Comments
 (0)