Skip to content

Commit 85ae43f

Browse files
authored
Merge pull request #52 from JuliaString/spj/ver
Update version and requirement for MurmurHash3
2 parents 20c5d07 + 8a8a88f commit 85ae43f

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ShortStrings"
22
uuid = "63221d1c-8677-4ff0-9126-0ff0817b4975"
33
authors = ["Dai ZJ <zhuojia.dai@gmail.com>", "ScottPJones <scottjones@alum.mit.edu>", "Lyndon White <lyndon.white@invenialabs.co.uk>"]
4-
version = "0.3.8"
4+
version = "0.3.9"
55

66
[deps]
77
BitIntegers = "c3b6d118-76ef-56ca-8cc7-ebb389d030a1"
@@ -10,7 +10,7 @@ SortingAlgorithms = "a2af1166-a08f-5f64-846c-94a0d3cef48c"
1010

1111
[compat]
1212
BitIntegers = "0.2"
13-
MurmurHash3 = "1.1"
13+
MurmurHash3 = "1.2"
1414
SortingAlgorithms = "0.3"
1515
julia = "1"
1616

src/ShortStrings.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,15 @@ export @ss_str, @ss3_str, @ss7_str, @ss15_str, @ss31_str, @ss63_str, @ss127_str,
99

1010
include("base.jl")
1111

12-
using MurmurHash3: mmhash128_a
12+
using MurmurHash3: mmhash128_a, mmhash32
1313

1414
function Base.hash(x::ShortString, h::UInt)
1515
h += Base.memhash_seed
16+
@static if UInt === UInt64
1617
last(mmhash128_a(sizeof(x), bswap(x.size_content), h%UInt32)) + h
18+
else
19+
mmhash32(sizeof(x), bswap(x.size_content), h%UInt32) + h
20+
end
1721
end
1822

1923
end # module

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ ss = ShortString15(s)
6666
@test s[1] == ss[1]
6767

6868
@test ss127"Be honest, do you actually need a string longer than this. Seriously. C'mon this is pretty long." === ShortString127("Be honest, do you actually need a string longer than this. Seriously. C'mon this is pretty long.")
69-
@test ss63"Basically a failly long string really" === ShortString63("Basically a failly long string really")
69+
@test ss63"Basically a fairly long string really" === ShortString63("Basically a fairly long string really")
7070
@test ss31"A Longer String!!!" === ShortString31("A Longer String!!!")
7171

7272
@test ss15"Short String!!!" === ShortString15("Short String!!!")

0 commit comments

Comments
 (0)