builtin : fix issue with int.hex

pull/896/head
Antoine Folie 2019-07-01 17:00:09 +02:00 committed by Alexander Medvednikov
parent 61c7fa073b
commit 32e32cee5c
1 changed files with 2 additions and 2 deletions

View File

@ -125,8 +125,8 @@ pub fn (b bool) str() string {
pub fn (n int) hex() string {
s := n.str()
hex := malloc(s.len + 3) // 0x + \n
C.sprintf(hex, '0x%x', n)
return tos(hex, s.len + 3)
count := int(C.sprintf(hex, '0x%x', n))
return tos(hex, count)
}
pub fn (n i64) hex() string {