Skip to content

Commit

Permalink
remove more duplicate functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbyrne committed Sep 27, 2019
1 parent 893b32b commit 98752ea
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions base/ryu/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -372,23 +372,21 @@ end

const POW10_OFFSET_2, MIN_BLOCK_2, POW10_SPLIT_2 = generateinversetables()

bitlength(this) = Base.GMP.MPZ.sizeinbase(this, 2)

@inline function pow5invsplit(::Type{Float64}, i)
pow = big(5)^i
inv = div(big(1) << (bitlength(pow) - 1 + pow5_inv_bitcount(Float64)), pow) + 1
inv = div(big(1) << (ndigits(pow, base=2) - 1 + pow5_inv_bitcount(Float64)), pow) + 1
return (UInt64(inv & ((big(1) << 64) - 1)), UInt64(inv >> 64))
end

@inline function pow5invsplit(::Type{Float32}, i)
pow = big(5)^i
inv = div(big(1) << (bitlength(pow) - 1 + pow5_inv_bitcount(Float32)), pow) + 1
inv = div(big(1) << (ndigits(pow, base=2) - 1 + pow5_inv_bitcount(Float32)), pow) + 1
return UInt64(inv)
end

@inline function pow5invsplit(::Type{Float16}, i)
pow = big(5)^i
inv = div(big(1) << (bitlength(pow) - 1 + pow5_inv_bitcount(Float16)), pow) + 1
inv = div(big(1) << (ndigits(pow, base=2) - 1 + pow5_inv_bitcount(Float16)), pow) + 1
return UInt32(inv)
end

Expand Down

0 comments on commit 98752ea

Please sign in to comment.