[macruby-changes] [2306] MacRuby/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Thu Aug 13 10:59:09 PDT 2009
Revision: 2306
http://trac.macosforge.org/projects/ruby/changeset/2306
Author: pthomson at apple.com
Date: 2009-08-13 10:59:09 -0700 (Thu, 13 Aug 2009)
Log Message:
-----------
On 64-bit, bignums now use uint64_t and __uint128_t for their internal storage, which provides a pretty significant speed boost.
Modified Paths:
--------------
MacRuby/trunk/bignum.c
MacRuby/trunk/include/ruby/defines.h
Modified: MacRuby/trunk/bignum.c
===================================================================
--- MacRuby/trunk/bignum.c 2009-08-13 07:35:57 UTC (rev 2305)
+++ MacRuby/trunk/bignum.c 2009-08-13 17:59:09 UTC (rev 2306)
@@ -310,7 +310,7 @@
VALUE
rb_quad_unpack(const char *buf, int sign)
{
- unsigned LONG_LONG q;
+ BDIGIT_DBL q;
long neg = 0;
long i;
BDIGIT *digits;
@@ -875,7 +875,11 @@
num %= hbase;
}
if (trim && ds[i-1] == 0) i--;
- k = SIZEOF_BDIGITS;
+#ifdef __LP64__
+ k = SIZEOF_BDIGITS/2;
+#else
+ k = SIZEOF_BDIGITS;
+#endif
while (k--) {
ptr[--j] = ruby_digitmap[num % base];
num /= base;
Modified: MacRuby/trunk/include/ruby/defines.h
===================================================================
--- MacRuby/trunk/include/ruby/defines.h 2009-08-13 07:35:57 UTC (rev 2305)
+++ MacRuby/trunk/include/ruby/defines.h 2009-08-13 17:59:09 UTC (rev 2306)
@@ -77,7 +77,12 @@
# define SIZEOF_LONG_LONG SIZEOF___INT64
#endif
-#if SIZEOF_INT*2 <= SIZEOF_LONG_LONG
+#if defined(__LP64__)
+# 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090813/1f1e590d/attachment.html>
More information about the macruby-changes
mailing list