From 46eac22172dff7a59def6f5f79ab7bf4e2eefd96 Mon Sep 17 00:00:00 2001 From: Juan Carlos Date: Thu, 3 Nov 2022 05:44:11 -0300 Subject: [PATCH] Improve dollar int (#20737) Improve dollar --- compiler/int128.nim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compiler/int128.nim b/compiler/int128.nim index 4791954a29..e357706b93 100644 --- a/compiler/int128.nim +++ b/compiler/int128.nim @@ -429,7 +429,7 @@ proc `mod`*(a, b: Int128): Int128 = proc addInt128*(result: var string; value: Int128) = let initialSize = result.len if value == Zero: - result.add "0" + result.add '0' elif value == low(Int128): result.add "-170141183460469231731687303715884105728" else: @@ -450,6 +450,8 @@ proc addInt128*(result: var string; value: Int128) = j -= 1 proc `$`*(a: Int128): string = + # "-170141183460469231731687303715884105728".len == 41 + result = newStringOfCap(41) result.addInt128(a) proc parseDecimalInt128*(arg: string, pos: int = 0): Int128 =