yarv-diff:217
From: ko1 atdot.net
Date: 9 Feb 2006 17:09:35 -0000
Subject: [yarv-diff:217] r375 - trunk
Author: matz
Date: 2006-02-10 02:09:35 +0900 (Fri, 10 Feb 2006)
New Revision: 375
Modified:
trunk/numeric.c
trunk/re.c
Log:
merge 1.9 modifies.
Modified: trunk/numeric.c
===================================================================
--- trunk/numeric.c 2006-02-09 16:14:54 UTC (rev 374)
+++ trunk/numeric.c 2006-02-09 17:09:35 UTC (rev 375)
@@ -242,6 +242,8 @@
}
+static VALUE num_floor(VALUE num);
+
/*
* call-seq:
* num.div(numeric) => integer
@@ -254,7 +256,7 @@
static VALUE
num_div(VALUE x, VALUE y)
{
- return rb_Integer(rb_funcall(x, '/', 1, y));
+ return num_floor(rb_funcall(x, '/', 1, y));
}
@@ -347,6 +349,20 @@
/*
* call-seq:
+ * num.scalar? -> true or false
+ *
+ * Returns <code>true</code> if <i>num</i> is an <code>Scalar</code>
+ * (i.e. non <code>Complex</code>).
+ */
+
+static VALUE
+num_scalar_p(VALUE num)
+{
+ return Qtrue;
+}
+
+/*
+ * call-seq:
* num.integer? -> true or false
*
* Returns <code>true</code> if <i>num</i> is an <code>Integer</code>
@@ -1865,10 +1881,6 @@
if (argc == 0) base = 10;
else base = NUM2INT(b);
- if (base == 2) {
- /* rb_fix2str() does not handle binary */
- return rb_big2str(rb_int2big(FIX2INT(x)), 2);
- }
return rb_fix2str(x, base);
}
@@ -1958,6 +1970,10 @@
fix_mul(VALUE x, VALUE y)
{
if (FIXNUM_P(y)) {
+#ifdef __HP_cc
+/* avoids an optimization bug of HP aC++/ANSI C B3910B A.06.05 [Jul 25 2005] */
+ volatile
+#endif
long a, b, c;
VALUE r;
@@ -2053,7 +2069,7 @@
return rb_big_div(x, y);
case T_FLOAT:
if (flo) {
- return rb_float_new((double)FIX2LONG(x) / RFLOAT(y)->value);
+ return rb_float_new((double)FIX2LONG(x) / RFLOAT(y)->value);
}
else {
long div = (double)FIX2LONG(x) / RFLOAT(y)->value;
@@ -2065,7 +2081,7 @@
}
/*
- * call-seq:
+ * call-seq:
* fix / numeric => numeric_result
*
* Performs division: the class of the resulting object depends on
@@ -2651,6 +2667,7 @@
static VALUE
int_upto(VALUE from, VALUE to)
{
+ RETURN_ENUMERATOR(from, 1, &to);
if (FIXNUM_P(from) && FIXNUM_P(to)) {
long i, end;
@@ -2689,6 +2706,7 @@
static VALUE
int_downto(VALUE from, VALUE to)
{
+ RETURN_ENUMERATOR(from, 1, &to);
if (FIXNUM_P(from) && FIXNUM_P(to)) {
long i, end;
@@ -2731,6 +2749,8 @@
int_dotimes(VALUE num)
{
VALUE val;
+
+ RETURN_ENUMERATOR(num, 0, 0);
if((val = yarv_invoke_Integer_times_special_block(num)) != Qundef){
return val;
}
@@ -2810,6 +2830,7 @@
rb_define_method(rb_cNumeric, "abs", num_abs, 0);
rb_define_method(rb_cNumeric, "to_int", num_to_int, 0);
+ rb_define_method(rb_cNumeric, "scalar?", num_scalar_p, 0);
rb_define_method(rb_cNumeric, "integer?", num_int_p, 0);
rb_define_method(rb_cNumeric, "zero?", num_zero_p, 0);
rb_define_method(rb_cNumeric, "nonzero?", num_nonzero_p, 0);
Modified: trunk/re.c
===================================================================
--- trunk/re.c 2006-02-09 16:14:54 UTC (rev 374)
+++ trunk/re.c 2006-02-09 17:09:35 UTC (rev 375)
@@ -2,7 +2,7 @@
re.c -
- $Author: ocean $
+ $Author: akr $
created at: Mon Aug 9 18:24:49 JST 1993
Copyright (C) 1993-2003 Yukihiro Matsumoto
@@ -1384,6 +1384,7 @@
VALUE
rb_reg_regcomp(VALUE str)
{
+ volatile VALUE save_str = str;
if (reg_cache && RREGEXP(reg_cache)->len == RSTRING(str)->len
&& case_cache == ruby_ignorecase
&& kcode_cache == reg_kcode
--
ML: yarv-diff quickml.atdot.net
Info: http://www.atdot.net/~ko1/quickml