[macruby-changes] [2045] MacRuby/branches/experimental/bignum.c
source_changes at macosforge.org
source_changes at macosforge.org
Wed Jul 22 09:47:51 PDT 2009
Revision: 2045
http://trac.macosforge.org/projects/ruby/changeset/2045
Author: pthomson at apple.com
Date: 2009-07-22 09:47:51 -0700 (Wed, 22 Jul 2009)
Log Message:
-----------
Fixed an incorrect method declaration in bignum.c. I hate it when people try to be clever and use VALUEs as unsigned longs.
Modified Paths:
--------------
MacRuby/branches/experimental/bignum.c
Modified: MacRuby/branches/experimental/bignum.c
===================================================================
--- MacRuby/branches/experimental/bignum.c 2009-07-21 23:35:12 UTC (rev 2044)
+++ MacRuby/branches/experimental/bignum.c 2009-07-22 16:47:51 UTC (rev 2045)
@@ -1013,7 +1013,7 @@
return rb_big2str(x, base);
}
-static VALUE
+static unsigned long
big2ulong(VALUE x, const char *type, int check)
{
long len = RBIGNUM_LEN(x);
@@ -1031,26 +1031,26 @@
num = BIGUP(num);
num += ds[len];
}
- return num;
+ return (unsigned long)num;
}
-VALUE
+unsigned long
rb_big2ulong_pack(VALUE x)
{
- VALUE num = big2ulong(x, "unsigned long", Qfalse);
+ unsigned long num = big2ulong(x, "unsigned long", Qfalse);
if (!RBIGNUM_SIGN(x)) {
return -num;
}
return num;
}
-VALUE
+unsigned long
rb_big2ulong(VALUE x)
{
VALUE num = big2ulong(x, "unsigned long", Qtrue);
if (!RBIGNUM_SIGN(x)) {
- if ((SIGNED_VALUE)num < 0) {
+ if ((long)num < 0) {
rb_raise(rb_eRangeError, "bignum out of range of unsigned long");
}
return -num;
@@ -1058,7 +1058,7 @@
return num;
}
-SIGNED_VALUE
+long
rb_big2long(VALUE x)
{
VALUE num = big2ulong(x, "long", Qtrue);
@@ -1067,7 +1067,7 @@
(RBIGNUM_SIGN(x) || (SIGNED_VALUE)num != LONG_MIN)) {
rb_raise(rb_eRangeError, "bignum too big to convert into `long'");
}
- if (!RBIGNUM_SIGN(x)) return -(SIGNED_VALUE)num;
+ if (!RBIGNUM_SIGN(x)) return -(long)num;
return num;
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090722/3555a962/attachment.html>
More information about the macruby-changes
mailing list