From 98752ea180abfe7fa1f794c2538bf4e9d67b1c9d Mon Sep 17 00:00:00 2001 From: Simon Byrne Date: Fri, 27 Sep 2019 15:54:33 -0700 Subject: [PATCH] remove more duplicate functionality --- base/ryu/utils.jl | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/base/ryu/utils.jl b/base/ryu/utils.jl index b9b4bac675cb45..656b28a4021788 100644 --- a/base/ryu/utils.jl +++ b/base/ryu/utils.jl @@ -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