@@ -616,7 +616,7 @@ ndigits(x::Integer; base::Integer=10, pad::Integer=1) = max(pad, ndigits0z(x, ba
616
616
# # integer to string functions ##
617
617
618
618
function bin (x:: Unsigned , pad:: Int , neg:: Bool )
619
- m = 8 sizeof (x) - leading_zeros (x):: Int
619
+ m = 8 sizeof (x) - leading_zeros (x)
620
620
n = neg + max (pad, m)
621
621
a = StringVector (n)
622
622
# for i in 0x0:UInt(n-1) # automatic vectorization produces redundant codes
@@ -643,7 +643,7 @@ function bin(x::Unsigned, pad::Int, neg::Bool)
643
643
end
644
644
645
645
function oct (x:: Unsigned , pad:: Int , neg:: Bool )
646
- m = div (8 sizeof (x) - leading_zeros (x):: Int + 2 , 3 )
646
+ m = div (8 sizeof (x) - leading_zeros (x) + 2 , 3 )
647
647
n = neg + max (pad, m)
648
648
a = StringVector (n)
649
649
i = n
660
660
const _dec_d100 = UInt16[(0x30 + i % 10 ) << 0x8 + (0x30 + i ÷ 10 ) for i = 0 : 99 ]
661
661
662
662
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)
664
664
a = StringVector (n)
665
665
i = n
666
666
@inbounds while i >= 2
@@ -679,7 +679,7 @@ function dec(x::Unsigned, pad::Int, neg::Bool)
679
679
end
680
680
681
681
function hex (x:: Unsigned , pad:: Int , neg:: Bool )
682
- m = 2 sizeof (x) - (leading_zeros (x):: Int >> 2 )
682
+ m = 2 sizeof (x) - (leading_zeros (x) >> 2 )
683
683
n = neg + max (pad, m)
684
684
a = StringVector (n)
685
685
i = n
@@ -707,7 +707,7 @@ function _base(base::Integer, x::Integer, pad::Int, neg::Bool)
707
707
2 <= abs (base) <= 62 || throw (DomainError (base, " base must satisfy 2 ≤ abs(base) ≤ 62" ))
708
708
b = (base % Int):: Int
709
709
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)
711
711
a = StringVector (n)
712
712
i = n
713
713
@inbounds while i > neg
0 commit comments