Skip to content

Commit

Permalink
Add UInt/Int to _str_sizehint for printing to strings (#40718)
Browse files Browse the repository at this point in the history
* Add UInt/Int to _str_sizehint for printing to strings

Co-authored-by: Kristoffer Carlsson <kcarlsson89@gmail.com>
  • Loading branch information
Seelengrab and KristofferC authored Feb 13, 2023
1 parent f687991 commit b4e6b03
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions base/strings/io.jl
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ function _str_sizehint(x)
return sizeof(x)
elseif x isa Char
return ncodeunits(x)
elseif x isa UInt64 || x isa UInt32
return ndigits(x)
elseif x isa Int64 || x isa Int32
return ndigits(x) + (x < zero(x))
else
return 8
end
Expand Down

0 comments on commit b4e6b03

Please sign in to comment.