Skip to content

Commit

Permalink
faster BigInt hashing (fix JuliaLang#8727)
Browse files Browse the repository at this point in the history
`sizeinbase` from gmp is exact for powers of two, so the checks are not needed.
  • Loading branch information
rfourquet committed Oct 18, 2014
1 parent 8c02093 commit 2e167fe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion base/hashing2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function hash(x::Real, h::Uint)

# handle values representable as Int64, Uint64, Float64
if den == 1
left = ndigits0z(num,2) + pow
left = int(ccall((:__gmpz_sizeinbase,:libgmp), Culong, (Ptr{BigInt}, Int32), &num, 2)) + pow
right = trailing_zeros(num) + pow
if -1074 <= right
if 0 <= right && left <= 64
Expand Down

0 comments on commit 2e167fe

Please sign in to comment.