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

make function arguments immutable by default

This commit is contained in:
Alexander Medvednikov
2019-08-07 08:19:27 +02:00
parent 06b8bd9382
commit 34e0b164eb
22 changed files with 107 additions and 83 deletions

View File

@ -134,6 +134,7 @@ pub fn exp2(a f64) f64 {
// factorial calculates the factorial of the provided value.
// TODO bring back once multiple value functions are implemented
/*
fn recursive_product( n int, current_number_ptr &int) int{
mut m := n / 2
if (m == 0){
@ -174,6 +175,7 @@ pub fn factorial(n int) i64 {
}
return i64((r << shift))
}
*/
// floor returns the nearest integer lower or equal of the provided value.
pub fn floor(a f64) f64 {
@ -191,7 +193,9 @@ pub fn gamma(a f64) f64 {
}
// gcd calculates greatest common (positive) divisor (or zero if a and b are both zero).
pub fn gcd(a, b i64) i64 {
pub fn gcd(a_, b_ i64) i64 {
mut a := a_
mut b := b_
if a < 0 {
a = -a
}