Skip to content

Commit ba0839e

Browse files
committed
Omit unnecessary type assertions
1 parent 6e06b3d commit ba0839e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

base/intfuncs.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ ndigits(x::Integer; base::Integer=10, pad::Integer=1) = max(pad, ndigits0z(x, ba
616616
## integer to string functions ##
617617

618618
function bin(x::Unsigned, pad::Int, neg::Bool)
619-
m = 8sizeof(x) - leading_zeros(x)::Int
619+
m = 8sizeof(x) - leading_zeros(x)
620620
n = neg + max(pad, m)
621621
a = StringVector(n)
622622
# for i in 0x0:UInt(n-1) # automatic vectorization produces redundant codes
@@ -643,7 +643,7 @@ function bin(x::Unsigned, pad::Int, neg::Bool)
643643
end
644644

645645
function oct(x::Unsigned, pad::Int, neg::Bool)
646-
m = div(8sizeof(x) - leading_zeros(x)::Int + 2, 3)
646+
m = div(8sizeof(x) - leading_zeros(x) + 2, 3)
647647
n = neg + max(pad, m)
648648
a = StringVector(n)
649649
i = n
@@ -660,7 +660,7 @@ end
660660
const _dec_d100 = UInt16[(0x30 + i % 10) << 0x8 + (0x30 + i ÷ 10) for i = 0:99]
661661

662662
function dec(x::Unsigned, pad::Int, neg::Bool)
663-
n = neg + (ndigits(x, base=10, pad=pad) % Int)::Int
663+
n = neg + ndigits(x, pad=pad)
664664
a = StringVector(n)
665665
i = n
666666
@inbounds while i >= 2
@@ -679,7 +679,7 @@ function dec(x::Unsigned, pad::Int, neg::Bool)
679679
end
680680

681681
function hex(x::Unsigned, pad::Int, neg::Bool)
682-
m = 2sizeof(x) - (leading_zeros(x)::Int >> 2)
682+
m = 2sizeof(x) - (leading_zeros(x) >> 2)
683683
n = neg + max(pad, m)
684684
a = StringVector(n)
685685
i = n
@@ -707,7 +707,7 @@ function _base(base::Integer, x::Integer, pad::Int, neg::Bool)
707707
2 <= abs(base) <= 62 || throw(DomainError(base, "base must satisfy 2 ≤ abs(base) ≤ 62"))
708708
b = (base % Int)::Int
709709
digits = abs(b) <= 36 ? base36digits : base62digits
710-
n = neg + (ndigits(x, base=b, pad=pad) % Int)::Int
710+
n = neg + ndigits(x, base=b, pad=pad)
711711
a = StringVector(n)
712712
i = n
713713
@inbounds while i > neg

0 commit comments

Comments
 (0)