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

strconv: minor fixes

This commit is contained in:
penguindark 2020-05-24 21:06:35 +02:00 committed by GitHub
parent 9315589f85
commit 4e66c12557
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -628,9 +628,7 @@ pub fn v_sprintf(str string, pt ... voidptr) string{
// h for 16 bit int // h for 16 bit int
// hh fot 8 bit int // hh fot 8 bit int
`h` { `h` {
//i++
if ch2 == `h` { if ch2 == `h` {
//i++
x := *(&i8(pt[p_index])) x := *(&i8(pt[p_index]))
positive = if x >= 0 { true } else { false } positive = if x >= 0 { true } else { false }
d1 = if positive { u64(x) } else { u64(-x) } d1 = if positive { u64(x) } else { u64(-x) }
@ -643,17 +641,21 @@ pub fn v_sprintf(str string, pt ... voidptr) string{
// l i64 // l i64
// ll i64 for now // ll i64 for now
`l` { `l` {
//i++ // placeholder for future 128bit integer code
/*
if ch2 == `l` { if ch2 == `l` {
//i++ x := *(&i128(pt[p_index]))
x := *(&i64(pt[p_index]))
positive = if x >= 0 { true } else { false } positive = if x >= 0 { true } else { false }
d1 = if positive { u64(x) } else { u64(-x) } d1 = if positive { u128(x) } else { u128(-x) }
} else { } else {
x := *(&i64(pt[p_index])) x := *(&i64(pt[p_index]))
positive = if x >= 0 { true } else { false } positive = if x >= 0 { true } else { false }
d1 = if positive { u64(x) } else { u64(-x) } d1 = if positive { u64(x) } else { u64(-x) }
} }
*/
x := *(&i64(pt[p_index]))
positive = if x >= 0 { true } else { false }
d1 = if positive { u64(x) } else { u64(-x) }
} }
// defualt int // defualt int
else { else {
@ -682,9 +684,7 @@ pub fn v_sprintf(str string, pt ... voidptr) string{
// h for 16 bit unsigned int // h for 16 bit unsigned int
// hh fot 8 bit unsigned int // hh fot 8 bit unsigned int
`h` { `h` {
//i++
if ch2 == `h` { if ch2 == `h` {
//i++
d1 = u64(*(&byte(pt[p_index]))) d1 = u64(*(&byte(pt[p_index])))
} else { } else {
d1 = u64(*(&u16(pt[p_index]))) d1 = u64(*(&u16(pt[p_index])))
@ -693,13 +693,15 @@ pub fn v_sprintf(str string, pt ... voidptr) string{
// l u64 // l u64
// ll u64 for now // ll u64 for now
`l` { `l` {
//i++ // placeholder for future 128bit integer code
/*
if ch2 == `l` { if ch2 == `l` {
//i++ d1 = u128(*(&u128(pt[p_index])))
d1 = u64(*(&u64(pt[p_index])))
} else { } else {
d1 = u64(*(&u64(pt[p_index]))) d1 = u64(*(&u64(pt[p_index])))
} }
*/
d1 = u64(*(&u64(pt[p_index])))
} }
// defualt int // defualt int
else { else {
@ -722,9 +724,7 @@ pub fn v_sprintf(str string, pt ... voidptr) string{
// h for 16 bit int // h for 16 bit int
// hh fot 8 bit int // hh fot 8 bit int
`h` { `h` {
//i++
if ch2 == `h` { if ch2 == `h` {
//i++
x := *(&i8(pt[p_index])) x := *(&i8(pt[p_index]))
s = x.hex() s = x.hex()
} else { } else {
@ -735,15 +735,18 @@ pub fn v_sprintf(str string, pt ... voidptr) string{
// l i64 // l i64
// ll i64 for now // ll i64 for now
`l` { `l` {
//i++ // placeholder for future 128bit integer code
/*
if ch2 == `l` { if ch2 == `l` {
// i++ x := *(&i128(pt[p_index]))
x := *(&i64(pt[p_index]))
s = x.hex() s = x.hex()
} else { } else {
x := *(&i64(pt[p_index])) x := *(&i64(pt[p_index]))
s = x.hex() s = x.hex()
} }
*/
x := *(&i64(pt[p_index]))
s = x.hex()
} }
else { else {
x := *(&int(pt[p_index])) x := *(&int(pt[p_index]))