Rename mrb_flo_to_fixnum to mrb_float_to_integer.

This commit is contained in:
Yukihiro "Matz" Matsumoto
2021-05-17 07:59:26 +09:00
parent fbbcee835f
commit 080fdbf9e8
4 changed files with 9 additions and 8 deletions
+1 -2
View File
@@ -1357,13 +1357,12 @@ int_to_f(mrb_state *mrb, mrb_value num)
*/
/* ------------------------------------------------------------------------*/
MRB_API mrb_value
mrb_flo_to_fixnum(mrb_state *mrb, mrb_value x)
mrb_float_to_integer(mrb_state *mrb, mrb_value x)
{
mrb_int z = 0;
if (!mrb_float_p(x)) {
mrb_raise(mrb, E_TYPE_ERROR, "non float value");
z = 0; /* not reached. just suppress warnings. */
}
else {
mrb_float d = mrb_float(x);
+2 -2
View File
@@ -513,7 +513,7 @@ mrb_to_int(mrb_state *mrb, mrb_value val)
if (!mrb_integer_p(val)) {
#ifndef MRB_NO_FLOAT
if (mrb_float_p(val)) {
return mrb_flo_to_fixnum(mrb, val);
return mrb_float_to_integer(mrb, val);
}
#endif
if (mrb_string_p(val)) {
@@ -537,7 +537,7 @@ mrb_convert_to_integer(mrb_state *mrb, mrb_value val, mrb_int base)
#ifndef MRB_NO_FLOAT
case MRB_TT_FLOAT:
if (base != 0) goto arg_error;
return mrb_flo_to_fixnum(mrb, val);
return mrb_float_to_integer(mrb, val);
#endif
case MRB_TT_INTEGER: