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

scanner: speed up Scanner.skip_whitespace (~2-3% speed up of -o x.c cmd/v)

This commit is contained in:
Delyan Angelov
2021-05-03 14:14:32 +03:00
parent d3f2d6f6df
commit 597a774d36
4 changed files with 29 additions and 39 deletions

View File

@@ -5,27 +5,15 @@ module mathutil
[inline]
pub fn min<T>(a T, b T) T {
if a < b {
return a
} else {
return b
}
return if a < b { a } else { b }
}
[inline]
pub fn max<T>(a T, b T) T {
if a > b {
return a
} else {
return b
}
return if a > b { a } else { b }
}
[inline]
pub fn abs<T>(a T) T {
if a > 0 {
return a
} else {
return -a
}
return if a > 0 { a } else { -a }
}