From f1c131ae49e9e314fd452dbb387c26882fa75059 Mon Sep 17 00:00:00 2001 From: Lilith Orion Hafner Date: Mon, 29 May 2023 10:04:35 -0500 Subject: [PATCH] Use `top_set_bit` to optimize `hash(Real)` --- base/float.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/float.jl b/base/float.jl index eb30c087c0f8c..3ea45fd140176 100644 --- a/base/float.jl +++ b/base/float.jl @@ -687,7 +687,7 @@ function hash(x::Real, h::UInt) # handle values representable as Int64, UInt64, Float64 if den == 1 - left = ndigits0z(num,2) + pow + left = top_set_bit(num) + pow right = trailing_zeros(num) + pow if -1074 <= right if 0 <= right && left <= 64