Simplify addInt, remove digits10 (#18356)

* Simplify addInt, remove digits10

Co-authored-by: Charles Blake <charlechaud@gmail.com>

* Fix bootstrapping

* Add noInit to tmp array

* noInit -> noinit

Co-authored-by: Charles Blake <charlechaud@gmail.com>
This commit is contained in:
Clyybber 2021-06-28 15:00:14 +02:00 • committed by GitHub
commit 6e74fecb42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 68 deletions

View file

@ -7,9 +7,7 @@ proc `$`*(x: int): string {.magic: "IntToStr", noSideEffect.}
## spelling `toString`:idx:.
template dollarImpl(x: uint | uint64, result: var string) =
let length = digits10(x)
setLen(result, length)
numToString(result, x, length)
addIntImpl(result, x)
when defined(js):
import std/private/since