adds strutils.toHex variant that knows about the used integer size
This commit is contained in:
parent
a1291a3187
commit
dc4a30c6b1
1 changed files with 4 additions and 0 deletions
|
|
@ -542,6 +542,10 @@ proc toHex*(x: BiggestInt, len: Positive): string {.noSideEffect,
|
|||
# handle negative overflow
|
||||
if n == 0 and x < 0: n = -1
|
||||
|
||||
proc toHex*[T](x: T): string =
|
||||
## Shortcut for ``toHex(x, T.sizeOf * 2)``
|
||||
toHex(x, T.sizeOf * 2)
|
||||
|
||||
proc intToStr*(x: int, minchars: Positive = 1): string {.noSideEffect,
|
||||
rtl, extern: "nsuIntToStr".} =
|
||||
## Converts `x` to its decimal representation.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue