diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2019-06-02 14:24:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-02 14:24:38 +0200 |
commit | 5eb47f8ed920a909eb6999ae8fb683d688c48ec5 (patch) | |
tree | 6c39f6443e5bdb3326405dd06cd1bad0cede59fd /lib | |
parent | c02320e2302ee955dfe3130814f634269136ef5b (diff) | |
download | Nim-5eb47f8ed920a909eb6999ae8fb683d688c48ec5.tar.gz |
fixes #11369 (#11381)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pure/strutils.nim | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/pure/strutils.nim b/lib/pure/strutils.nim index 7e6d31727..114141e45 100644 --- a/lib/pure/strutils.nim +++ b/lib/pure/strutils.nim @@ -892,14 +892,14 @@ proc toBin*(x: BiggestInt, len: Positive): string {.noSideEffect, doAssert b.toBin(8) == "00000001" doAssert b.toBin(9) == "100000001" var - mask: BiggestInt = 1 - shift: BiggestInt = 0 + mask = BiggestUInt 1 + shift = BiggestUInt 0 assert(len > 0) result = newString(len) for j in countdown(len-1, 0): - result[j] = chr(int((x and mask) shr shift) + ord('0')) - shift = shift + 1 - mask = mask shl 1 + result[j] = chr(int((BiggestUInt(x) and mask) shr shift) + ord('0')) + inc shift + mask = mask shl BiggestUInt(1) proc toOct*(x: BiggestInt, len: Positive): string {.noSideEffect, rtl, extern: "nsuToOct".} = @@ -917,14 +917,14 @@ proc toOct*(x: BiggestInt, len: Positive): string {.noSideEffect, doAssert b.toOct(3) == "001" doAssert b.toOct(5) == "01001" var - mask: BiggestInt = 7 - shift: BiggestInt = 0 + mask = BiggestUInt 7 + shift = BiggestUInt 0 assert(len > 0) result = newString(len) for j in countdown(len-1, 0): - result[j] = chr(int((x and mask) shr shift) + ord('0')) - shift = shift + 3 - mask = mask shl 3 + result[j] = chr(int((BiggestUInt(x) and mask) shr shift) + ord('0')) + inc shift, 3 + mask = mask shl BiggestUInt(3) proc toHex*(x: BiggestInt, len: Positive): string {.noSideEffect, rtl, extern: "nsuToHex".} = |