Skip to content

Commit 7472f6b

Browse files
committed
Further fix for abstract strings on 32-bit systems
1 parent 99d1dbb commit 7472f6b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ authors = ["ScottPJones <[email protected]>"]
44
keywords = ["Strings"]
55
license = "MIT"
66
uuid = "e79e7a6a-7bb1-5a4d-9d64-da657b06f53a"
7-
version = "1.0.2"
7+
version = "1.0.3"
88

99
[deps]
1010
Unicode = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"

src/hash.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ mmhash128(str::Union{String, Str}, seed::UInt32) =
1515
is_aligned(pnt::Ptr) = (reinterpret(UInt, pnt) & (sizeof(UInt) - 1)%UInt) == 0
1616

1717
# Check alignment of substrings first
18-
function mmhash128(str::SubString, seed::UInt32)
18+
function mmhash128(str::SubString{S}, seed::UInt32) where {S<:Union{String, Str}}
1919
@preserve str begin
2020
pnt = pointer(str)
2121
if is_aligned(pnt)
@@ -44,7 +44,7 @@ else
4444
_hash(seed) = MurmurHash3.fmix(seed%UInt32) + seed
4545
# Optimized for hashing a UTF-8 compatible aligned string
4646
_hash(s, seed) = @preserve s mmhash32(sizeof(s), pointer(s), seed%UInt32) + seed
47-
_hash_abs(s, seed) = _hash(string(s), seed)
47+
_hash_abs(s, seed) = _hash(convert(String, s), seed)
4848
end
4949

5050
hash(str::Union{S,SubString{S}}, seed::UInt) where {S<:Str} =

0 commit comments

Comments
 (0)