Skip to content

Commit 9581e88

Browse files
committed
Omit unnecessary type assertions
1 parent 140809b commit 9581e88

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
@@ -602,7 +602,7 @@ ndigits(x::Integer; base::Integer=10, pad::Integer=1) = max(pad, ndigits0z(x, ba
602602
## integer to string functions ##
603603

604604
function bin(x::Unsigned, pad::Int, neg::Bool)
605-
m = 8sizeof(x) - leading_zeros(x)::Int
605+
m = 8sizeof(x) - leading_zeros(x)
606606
n = neg + max(pad, m)
607607
a = StringVector(n)
608608
# for i in 0x0:UInt(n-1) # automatic vectorization produces redundant codes
@@ -629,7 +629,7 @@ function bin(x::Unsigned, pad::Int, neg::Bool)
629629
end
630630

631631
function oct(x::Unsigned, pad::Int, neg::Bool)
632-
m = div(8sizeof(x) - leading_zeros(x)::Int + 2, 3)
632+
m = div(8sizeof(x) - leading_zeros(x) + 2, 3)
633633
n = neg + max(pad, m)
634634
a = StringVector(n)
635635
i = n
@@ -646,7 +646,7 @@ end
646646
const _dec_d100 = UInt16[(0x30 + i % 10) << 0x8 + (0x30 + i ÷ 10) for i = 0:99]
647647

648648
function dec(x::Unsigned, pad::Int, neg::Bool)
649-
n = neg + (ndigits(x, base=10, pad=pad) % Int)::Int
649+
n = neg + ndigits(x, pad=pad)
650650
a = StringVector(n)
651651
i = n
652652
@inbounds while i >= 2
@@ -665,7 +665,7 @@ function dec(x::Unsigned, pad::Int, neg::Bool)
665665
end
666666

667667
function hex(x::Unsigned, pad::Int, neg::Bool)
668-
m = 2sizeof(x) - (leading_zeros(x)::Int >> 2)
668+
m = 2sizeof(x) - (leading_zeros(x) >> 2)
669669
n = neg + max(pad, m)
670670
a = StringVector(n)
671671
i = n
@@ -693,7 +693,7 @@ function _base(base::Integer, x::Integer, pad::Int, neg::Bool)
693693
2 <= abs(base) <= 62 || throw(DomainError(base, "base must satisfy 2 ≤ abs(base) ≤ 62"))
694694
b = (base % Int)::Int
695695
digits = abs(b) <= 36 ? base36digits : base62digits
696-
n = neg + (ndigits(x, base=b, pad=pad) % Int)::Int
696+
n = neg + ndigits(x, base=b, pad=pad)
697697
a = StringVector(n)
698698
i = n
699699
@inbounds while i > neg

0 commit comments

Comments
 (0)