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

builtin,strconv: speedup str.int() conversions (without -prod)

This commit is contained in:
Delyan Angelov
2022-09-08 11:09:13 +03:00
parent a462610376
commit fc8e3d0971
10 changed files with 63 additions and 30 deletions

View File

@ -101,7 +101,7 @@ fn sub96(s2 u32, s1 u32, s0 u32, d2 u32, d1 u32, d0 u32) (u32, u32, u32) {
// Utility functions
fn is_digit(x u8) bool {
return (x >= strconv.c_zero && x <= strconv.c_nine) == true
return x >= strconv.c_zero && x <= strconv.c_nine
}
fn is_space(x u8) bool {
@ -109,7 +109,7 @@ fn is_space(x u8) bool {
}
fn is_exp(x u8) bool {
return (x == `E` || x == `e`) == true
return x == `E` || x == `e`
}
// Possible parser return values.
@ -124,6 +124,7 @@ enum ParserState {
// parser tries to parse the given string into a number
// NOTE: #TOFIX need one char after the last char of the number
[direct_array_access]
fn parser(s string) (ParserState, PrepNumber) {
mut digx := 0
mut result := ParserState.ok