Fixed printing of unsigned integers.
This commit is contained in:
parent
367f7ab3b7
commit
4d896d0eb7
@ -65,9 +65,9 @@ proc terminalWrite*(data: string) =
|
||||
proc terminalWrite*(data: char) =
|
||||
terminalWriteChar(data)
|
||||
|
||||
var parsedData = ['0','0','0','0','0','0','0','0','0','0']
|
||||
var parsedData: array[0..9, char]
|
||||
|
||||
proc terminalWrite*(data: int) =
|
||||
proc terminalWrite*(data: SomeSignedInt) =
|
||||
if(data == 0):
|
||||
terminalWrite('0')
|
||||
return
|
||||
@ -85,3 +85,17 @@ proc terminalWrite*(data: int) =
|
||||
i = i - 1
|
||||
terminalWrite(parsedData[i])
|
||||
|
||||
proc terminalWrite*(data: SomeUnsignedInt) =
|
||||
if(data == 0):
|
||||
terminalWrite('0')
|
||||
return
|
||||
var input = data
|
||||
var i = 0
|
||||
while(input != 0):
|
||||
let parsedChar: char = char(48'u + (input mod 10))
|
||||
parsedData[i] = parsedChar
|
||||
i = i + 1
|
||||
input = input div 10
|
||||
while i > 0:
|
||||
i = i - 1
|
||||
terminalWrite(parsedData[i])
|
||||
|
Loading…
Reference in New Issue
Block a user