summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/numeric.c4
-rw-r--r--src/string.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/src/numeric.c b/src/numeric.c
index 25a411de8..a9a2a641b 100644
--- a/src/numeric.c
+++ b/src/numeric.c
@@ -357,7 +357,11 @@ flo_shift(mrb_state *mrb, mrb_value x, mrb_int width)
while (width++) {
val /= 2;
}
+#if defined(_ISOC99_SOURCE)
val = trunc(val);
+#else
+ val = val > 0 ? floor(val) : ceil(val);
+#endif
if (val == 0 && mrb_float(x) < 0) {
return mrb_fixnum_value(-1);
}
diff --git a/src/string.c b/src/string.c
index a9351619b..c921ca56d 100644
--- a/src/string.c
+++ b/src/string.c
@@ -2773,7 +2773,7 @@ mrb_init_string(mrb_state *mrb)
#ifndef __STDC__
# ifdef __GNUC__
# define const __const__
-# else
+# elif !defined(_MSC_VER)
# define const
# endif
#endif