mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
v.util: add an iabs(x) helper (#9172)
This commit is contained in:
@@ -363,6 +363,11 @@ pub fn imax(a int, b int) int {
|
||||
return if a > b { a } else { b }
|
||||
}
|
||||
|
||||
[inline]
|
||||
pub fn iabs(v int) int {
|
||||
return if v > 0 { v } else { -v }
|
||||
}
|
||||
|
||||
pub fn replace_op(s string) string {
|
||||
if s.len == 1 {
|
||||
last_char := s[s.len - 1]
|
||||
|
||||
Reference in New Issue
Block a user