@@ -602,7 +602,7 @@ ndigits(x::Integer; base::Integer=10, pad::Integer=1) = max(pad, ndigits0z(x, ba
602
602
# # integer to string functions ##
603
603
604
604
function bin (x:: Unsigned , pad:: Int , neg:: Bool )
605
- m = 8 sizeof (x) - leading_zeros (x):: Int
605
+ m = 8 sizeof (x) - leading_zeros (x)
606
606
n = neg + max (pad, m)
607
607
a = StringVector (n)
608
608
# for i in 0x0:UInt(n-1) # automatic vectorization produces redundant codes
@@ -629,7 +629,7 @@ function bin(x::Unsigned, pad::Int, neg::Bool)
629
629
end
630
630
631
631
function oct (x:: Unsigned , pad:: Int , neg:: Bool )
632
- m = div (8 sizeof (x) - leading_zeros (x):: Int + 2 , 3 )
632
+ m = div (8 sizeof (x) - leading_zeros (x) + 2 , 3 )
633
633
n = neg + max (pad, m)
634
634
a = StringVector (n)
635
635
i = n
646
646
const _dec_d100 = UInt16[(0x30 + i % 10 ) << 0x8 + (0x30 + i ÷ 10 ) for i = 0 : 99 ]
647
647
648
648
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)
650
650
a = StringVector (n)
651
651
i = n
652
652
@inbounds while i >= 2
@@ -665,7 +665,7 @@ function dec(x::Unsigned, pad::Int, neg::Bool)
665
665
end
666
666
667
667
function hex (x:: Unsigned , pad:: Int , neg:: Bool )
668
- m = 2 sizeof (x) - (leading_zeros (x):: Int >> 2 )
668
+ m = 2 sizeof (x) - (leading_zeros (x) >> 2 )
669
669
n = neg + max (pad, m)
670
670
a = StringVector (n)
671
671
i = n
@@ -693,7 +693,7 @@ function _base(base::Integer, x::Integer, pad::Int, neg::Bool)
693
693
2 <= abs (base) <= 62 || throw (DomainError (base, " base must satisfy 2 ≤ abs(base) ≤ 62" ))
694
694
b = (base % Int):: Int
695
695
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)
697
697
a = StringVector (n)
698
698
i = n
699
699
@inbounds while i > neg
0 commit comments