1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

builtin: int to str without offset buffer

This commit is contained in:
penguindark 2020-03-21 16:00:58 +01:00 committed by GitHub
parent fc43294efc
commit 421f5b6fdf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -93,7 +93,9 @@ pub fn (nn int) str_l(max int) string {
buf[index] = `-`
}
return tos(buf + index, (max-index))
C.memmove(buf,buf+index, (max-index)+1 )
return tos(buf, (max-index))
//return tos(buf + index, (max-index))
}
pub fn (n i8) str() string {
@ -137,7 +139,9 @@ pub fn (nn u32) str() string {
index++
}
return tos(buf + index, (max-index))
C.memmove(buf,buf+index, (max-index)+1 )
return tos(buf, (max-index))
//return tos(buf + index, (max-index))
}
pub fn (nn i64) str() string {
@ -177,7 +181,9 @@ pub fn (nn i64) str() string {
buf[index] = `-`
}
return tos(buf + index, (max-index))
C.memmove(buf,buf+index, (max-index)+1 )
return tos(buf, (max-index))
//return tos(buf + index, (max-index))
}
pub fn (nn u64) str() string {
@ -205,7 +211,9 @@ pub fn (nn u64) str() string {
index++
}
return tos(buf + index, (max-index))
C.memmove(buf,buf+index, (max-index)+1 )
return tos(buf, (max-index))
//return tos(buf + index, (max-index))
}
pub fn (b bool) str() string {
@ -262,7 +270,9 @@ pub fn (nn u64) hex() string {
//buf[index] = `0`
index++
return tos(buf + index, (max-index))
C.memmove(buf,buf+index, (max-index)+1 )
return tos(buf, (max-index))
//return tos(buf + index, (max-index))
}
pub fn (nn i64) hex() string {