mirror of
https://github.com/neovim/neovim.git
synced 2025-09-11 13:58:18 +00:00
c99: remove vim_round #909
C89 did not have round(), vim emulated it with vim_round. But since we're using C99 this is not a problem anymore.
This commit is contained in:

committed by
Justin M. Keyes

parent
958b3c5ffb
commit
94f488d1ca
@@ -12177,15 +12177,6 @@ theend:
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* round() is not in C90, use ceil() or floor() instead.
|
|
||||||
*/
|
|
||||||
float_T vim_round(float_T f)
|
|
||||||
{
|
|
||||||
return f > 0 ? floor(f + 0.5) : ceil(f - 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* "round({float})" function
|
* "round({float})" function
|
||||||
*/
|
*/
|
||||||
@@ -12195,7 +12186,7 @@ static void f_round(typval_T *argvars, typval_T *rettv)
|
|||||||
|
|
||||||
rettv->v_type = VAR_FLOAT;
|
rettv->v_type = VAR_FLOAT;
|
||||||
if (get_float_arg(argvars, &f) == OK)
|
if (get_float_arg(argvars, &f) == OK)
|
||||||
rettv->vval.v_float = vim_round(f);
|
rettv->vval.v_float = round(f);
|
||||||
else
|
else
|
||||||
rettv->vval.v_float = 0.0;
|
rettv->vval.v_float = 0.0;
|
||||||
}
|
}
|
||||||
|
@@ -848,7 +848,7 @@ void profile_divide(proftime_T *tm, int count, proftime_T *tm2)
|
|||||||
double usec = (tm->tv_sec * 1000000.0 + tm->tv_usec) / count;
|
double usec = (tm->tv_sec * 1000000.0 + tm->tv_usec) / count;
|
||||||
|
|
||||||
tm2->tv_sec = floor(usec / 1000000.0);
|
tm2->tv_sec = floor(usec / 1000000.0);
|
||||||
tm2->tv_usec = vim_round(usec - (tm2->tv_sec * 1000000.0));
|
tm2->tv_usec = round(usec - (tm2->tv_sec * 1000000.0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user