summaryrefslogtreecommitdiff
path: root/time.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-03-28 01:13:00 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-03-28 01:13:00 +0000
commitd8cc6ccb566a4f302bd85c7a568eda0e434dd8d1 (patch)
treea33a7fcb66767f2a96256b7606c0c92f346dc33d /time.c
parent63dd50961e08172bb88358d95d50efee4c6eead0 (diff)
* time.c (rb_time_magnify): fix for LP64.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27075 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r--time.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/time.c b/time.c
index 1faa5c87b8..63780416dd 100644
--- a/time.c
+++ b/time.c
@@ -594,12 +594,22 @@ rb_time_magnify(VALUE v)
#else
long a, b, c;
a = FIX2LONG(v);
- if (a == 0)
- return x;
+ if (a == 0) {
+#if WIDEINT_IS_UINT64
+ WIDEVAL_SET(ret, INT64toFIXWV(0));
+#else
+ WIDEVAL_SET(ret, INT2FIX(0));
+#endif
+ return ret;
+ }
b = TIME_SCALE;
c = a * b;
if (c / a == b) {
+#if WIDEINT_IS_UINT64
WIDEVAL_SET(ret, INT64toFIXWV(c));
+#else
+ WIDEVAL_SET(ret, LONG2NUM(c));
+#endif
return ret;
}
#endif