From 044b28fe22908b6cb726fd2d3a7b9bc9cce71e67 Mon Sep 17 00:00:00 2001 From: Sebastian Stock <42280794+sostock@users.noreply.github.com> Date: Wed, 26 Jul 2023 08:16:46 +0200 Subject: [PATCH 1/4] Test on Julia 1.10 --- .github/workflows/CI.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 35607f7..d5b5e3e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -25,7 +25,8 @@ jobs: - '1.6' - '1.7' - '1.8' - - '~1.9.0-0' + - '1.9' + - '~1.10.0-0' - 'nightly' os: - ubuntu-latest From c2db8255959f580d091f33a6c42eef2149e36e41 Mon Sep 17 00:00:00 2001 From: Sebastian Stock <42280794+sostock@users.noreply.github.com> Date: Wed, 26 Jul 2023 08:20:59 +0200 Subject: [PATCH 2/4] Clarify condition --- src/HalfIntegers.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/HalfIntegers.jl b/src/HalfIntegers.jl index 42812a9..1f8828f 100644 --- a/src/HalfIntegers.jl +++ b/src/HalfIntegers.jl @@ -294,7 +294,7 @@ hashhalf(x::Integer, h::UInt) = invoke(hash, Tuple{Real,UInt}, half(x), h) # Version for integers with ≤ 64 bits, adapted from hash(::Rational{<:Base.BitInteger64}, ::UInt) function hashhalf(x::Base.BitInteger64, h::UInt) iseven(x) && return hash(x >> 1, h) - if abs(x) < 9007199254740992 + if Base.uabs(x) < UInt64(maxintfloat(Float64)) return hash(ldexp(Float64(x),-1),h) end h = Base.hash_integer(1, h) From 268717b54ea5fa61ee7fd4354c1a839c1180fbce Mon Sep 17 00:00:00 2001 From: Sebastian Stock <42280794+sostock@users.noreply.github.com> Date: Wed, 26 Jul 2023 08:23:16 +0200 Subject: [PATCH 3/4] Implement new hashing behavior in Julia 1.10 --- src/HalfIntegers.jl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/HalfIntegers.jl b/src/HalfIntegers.jl index 1f8828f..629b76f 100644 --- a/src/HalfIntegers.jl +++ b/src/HalfIntegers.jl @@ -297,7 +297,9 @@ function hashhalf(x::Base.BitInteger64, h::UInt) if Base.uabs(x) < UInt64(maxintfloat(Float64)) return hash(ldexp(Float64(x),-1),h) end - h = Base.hash_integer(1, h) + @static if VERSION < v"1.10.0-DEV.1448" + h = Base.hash_integer(1, h) + end h = Base.hash_integer(-1, h) h = Base.hash_integer(x, h) return h From d808f2aaa690f43aa048810f53510eac916dabc3 Mon Sep 17 00:00:00 2001 From: Sebastian Stock <42280794+sostock@users.noreply.github.com> Date: Fri, 28 Jul 2023 08:48:14 +0200 Subject: [PATCH 4/4] Add changelog item --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d4e1a5..db8a89b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## master +* ![Maintenance](https://img.shields.io/badge/-maintenance-grey) Implement new `hash` behavior on Julia ≥ 1.10. ([#55](https://github.com/sostock/HalfIntegers.jl/pull/55)) + ## v1.5.0 * ![Feature](https://img.shields.io/badge/-feature-green) Better support for `Half{T}` where `T` is an integer type that cannot represent the number 2. ([#49](https://github.com/sostock/HalfIntegers.jl/pull/49), [#51](https://github.com/sostock/HalfIntegers.jl/pull/51), [#52](https://github.com/sostock/HalfIntegers.jl/pull/52))