[macruby-changes] [5248] MacRuby/trunk

source_changes at macosforge.org source_changes at macosforge.org
Fri Feb 25 17:27:10 PST 2011


Revision: 5248
          http://trac.macosforge.org/projects/ruby/changeset/5248
Author:   lsansonetti at apple.com
Date:     2011-02-25 17:27:10 -0800 (Fri, 25 Feb 2011)
Log Message:
-----------
revert unwanted changes

Modified Paths:
--------------
    MacRuby/trunk/include/ruby/defines.h
    MacRuby/trunk/rational.c

Modified: MacRuby/trunk/include/ruby/defines.h
===================================================================
--- MacRuby/trunk/include/ruby/defines.h	2011-02-26 01:26:13 UTC (rev 5247)
+++ MacRuby/trunk/include/ruby/defines.h	2011-02-26 01:27:10 UTC (rev 5248)
@@ -76,7 +76,12 @@
 
 #include <AvailabilityMacros.h>
 
-#if SIZEOF_INT*2 <= SIZEOF_LONG_LONG
+#if defined(__LP64__) && (MAC_OS_X_VERSION_MAX_ALLOWED >= 1060)
+# define BDIGIT uint64_t
+# define SIZEOF_BDIGITS 8
+# define BDIGIT_DBL __uint128_t
+# define BDIGIT_DBL_SIGNED __int128_t
+#elif SIZEOF_INT*2 <= SIZEOF_LONG_LONG
 # define BDIGIT unsigned int
 # define SIZEOF_BDIGITS SIZEOF_INT
 # define BDIGIT_DBL unsigned LONG_LONG

Modified: MacRuby/trunk/rational.c
===================================================================
--- MacRuby/trunk/rational.c	2011-02-26 01:26:13 UTC (rev 5247)
+++ MacRuby/trunk/rational.c	2011-02-26 01:27:10 UTC (rev 5248)
@@ -349,6 +349,8 @@
     return nurat_s_new_internal(klass, ZERO, ONE);
 }
 
+#define rb_raise_zerodiv() rb_raise(rb_eZeroDivError, "divided by 0")
+
 #if 0
 static VALUE
 nurat_s_new_bang(int argc, VALUE *argv, VALUE klass)
@@ -373,7 +375,7 @@
 	    den = f_negate(den);
 	    break;
 	  case 0:
-	    rb_num_zerodiv();
+	    rb_raise_zerodiv();
 	    break;
 	}
 	break;
@@ -444,7 +446,7 @@
 	den = f_negate(den);
 	break;
       case 0:
-	rb_num_zerodiv();
+	rb_raise_zerodiv();
 	break;
     }
 
@@ -468,7 +470,7 @@
 	den = f_negate(den);
 	break;
       case 0:
-	rb_num_zerodiv();
+	rb_raise_zerodiv();
 	break;
     }
 
@@ -852,10 +854,9 @@
     switch (TYPE(other)) {
       case T_FIXNUM:
       case T_BIGNUM:
+	if (f_zero_p(other))
+	    rb_raise_zerodiv();
 	{
-	    if (f_zero_p(other)) {
-		rb_num_zerodiv();
-	    }
 	    get_dat1(self);
 
 	    return f_muldiv(self,
@@ -865,10 +866,9 @@
       case T_FLOAT:
 	return rb_funcall(f_to_f(self), '/', 1, other);
       case T_RATIONAL:
+	if (f_zero_p(other))
+	    rb_raise_zerodiv();
 	{
-	    if (f_zero_p(other)) {
-		rb_num_zerodiv();
-	    }
 	    get_dat2(self, other);
 
 	    if (f_one_p(self))
@@ -1587,7 +1587,7 @@
     dat->den = RARRAY_AT(ary ,1);
     rb_copy_generic_ivar(self, ary);
     if (f_zero_p(dat->den)) {
-	rb_num_zerodiv();
+	rb_raise_zerodiv();
     }
     return self;
 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20110225/683cb475/attachment.html>


More information about the macruby-changes mailing list