summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-01-02 23:49:41 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2021-01-02 23:49:41 +0900
commit17cb50f8d0d3bd24ad53e6543f2534ecc9f5a602 (patch)
treecc03fd120e174c36f9aaca6caae3c72414a8a14f
parent757902c497c01c88b4e960ca81ba491bf8728b45 (diff)
downloadmruby-17cb50f8d0d3bd24ad53e6543f2534ecc9f5a602.tar.gz
mruby-17cb50f8d0d3bd24ad53e6543f2534ecc9f5a602.zip
Avoid `int64_t` on 32 bit platforms.
-rw-r--r--mrbgems/mruby-rational/src/rational.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/mrbgems/mruby-rational/src/rational.c b/mrbgems/mruby-rational/src/rational.c
index a151e0453..deb48ef8a 100644
--- a/mrbgems/mruby-rational/src/rational.c
+++ b/mrbgems/mruby-rational/src/rational.c
@@ -102,8 +102,10 @@ rational_new(mrb_state *mrb, mrb_int numerator, mrb_int denominator)
*/
#ifdef MRB_INT32
typedef float rat_float;
+typedef int32_t rat_int;
#else
typedef double rat_float;
+typedef int64_t rat_int;
#endif
void mrb_check_num_exact(mrb_state *mrb, mrb_float num);
@@ -116,7 +118,7 @@ rational_new_f(mrb_state *mrb, mrb_float f0)
/* a: continued fraction coefficients. */
mrb_int a, h[3] = { 0, 1, 0 }, k[3] = { 1, 0, 0 };
mrb_int x, d;
- int64_t n = 1;
+ rat_int n = 1;
int i, neg = 0;
mrb_check_num_exact(mrb, f0);