diff --git a/vlib/builtin/int.v b/vlib/builtin/int.v index f7e97ef8bc..fda2dc3cc8 100644 --- a/vlib/builtin/int.v +++ b/vlib/builtin/int.v @@ -76,11 +76,6 @@ pub fn (nn u32) str() string { max := 16 mut buf := malloc(max) mut len := 0 - mut is_neg := false - if n < u32(0) { - n = -n - is_neg = true - } // Fill the string from the end for n > u32(0) { d := n % u32(10) @@ -88,11 +83,6 @@ pub fn (nn u32) str() string { len++ n = n / u32(10) } - // Prepend - if it's negative - if is_neg { - buf[max - len - 1] = `-` - len++ - } return tos(buf + max - len, len) } @@ -104,11 +94,6 @@ pub fn (nn u8) str() string { max := 5 mut buf := malloc(max) mut len := 0 - mut is_neg := false - if n < u8(0) { - n = -n - is_neg = true - } // Fill the string from the end for n > u8(0) { d := n % u8(10) @@ -116,11 +101,6 @@ pub fn (nn u8) str() string { len++ n = n / u8(10) } - // Prepend - if it's negative - if is_neg { - buf[max - len - 1] = `-` - len++ - } return tos(buf + max - len, len) } @@ -160,11 +140,6 @@ pub fn (nn u64) str() string { max := 32 mut buf := malloc(max) mut len := 0 - mut is_neg := false - if n < u64(0) { - n = -n - is_neg = true - } // Fill the string from the end for n > u64(0) { d := n % u64(10) @@ -172,11 +147,6 @@ pub fn (nn u64) str() string { len++ n = n / u64(10) } - // Prepend - if it's negative - if is_neg { - buf[max - len - 1] = `-` - len++ - } return tos(buf + max - len, len) }