From 32e32cee5c154dd78a68d8d41cad9dc2c69fc0a6 Mon Sep 17 00:00:00 2001 From: Antoine Folie Date: Mon, 1 Jul 2019 17:00:09 +0200 Subject: [PATCH] builtin : fix issue with int.hex --- vlib/builtin/int.v | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vlib/builtin/int.v b/vlib/builtin/int.v index 24a98c54c5..686a1c6806 100644 --- a/vlib/builtin/int.v +++ b/vlib/builtin/int.v @@ -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 {