mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* configure.in: Check __int128.
* include/ruby/defines.h (BDIGIT_DBL): Use uint128_t if it is available. (BDIGIT): Use uint64_t if uint128_t is available. (SIZEOF_BDIGITS): Defined for above case. (BDIGIT_DBL_SIGNED): Ditto. (PRI_BDIGIT_PREFIX): Ditto. * include/ruby/ruby.h (PRI_64_PREFIX): Defined. * bignum.c (rb_big_pow): Don't use BITSPERDIG for the condition which rb_big_pow returns Float or Bignum. [ruby-dev:47413] [Feature #8509] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41379 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ca7bdc882b
commit
1a6a65f16b
5 changed files with 33 additions and 2 deletions
17
ChangeLog
17
ChangeLog
|
@ -1,3 +1,20 @@
|
|||
Tue Jun 18 18:39:58 2013 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* configure.in: Check __int128.
|
||||
|
||||
* include/ruby/defines.h (BDIGIT_DBL): Use uint128_t if it is available.
|
||||
(BDIGIT): Use uint64_t if uint128_t is available.
|
||||
(SIZEOF_BDIGITS): Defined for above case.
|
||||
(BDIGIT_DBL_SIGNED): Ditto.
|
||||
(PRI_BDIGIT_PREFIX): Ditto.
|
||||
|
||||
* include/ruby/ruby.h (PRI_64_PREFIX): Defined.
|
||||
|
||||
* bignum.c (rb_big_pow): Don't use BITSPERDIG for the condition which
|
||||
rb_big_pow returns Float or Bignum.
|
||||
|
||||
[ruby-dev:47413] [Feature #8509]
|
||||
|
||||
Tue Jun 18 16:43:44 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* parse.y (parser_heredoc_restore): clear lex_strterm always to get
|
||||
|
|
2
bignum.c
2
bignum.c
|
@ -4332,7 +4332,7 @@ rb_big_pow(VALUE x, VALUE y)
|
|||
SIGNED_VALUE mask;
|
||||
const long xlen = RBIGNUM_LEN(x);
|
||||
const long xbits = BITSPERDIG*xlen - nlz(RBIGNUM_DIGITS(x)[xlen-1]);
|
||||
const long BIGLEN_LIMIT = BITSPERDIG*1024*1024;
|
||||
const long BIGLEN_LIMIT = 32*1024*1024;
|
||||
|
||||
if ((xbits > BIGLEN_LIMIT) || (xbits * yy > BIGLEN_LIMIT)) {
|
||||
rb_warn("in a**b, b may be too big");
|
||||
|
|
|
@ -1155,6 +1155,7 @@ RUBY_CHECK_SIZEOF(short)
|
|||
RUBY_CHECK_SIZEOF(long, [int], [ILP LP])
|
||||
RUBY_CHECK_SIZEOF(long long)
|
||||
RUBY_CHECK_SIZEOF(__int64)
|
||||
RUBY_CHECK_SIZEOF(__int128)
|
||||
RUBY_CHECK_SIZEOF(off_t)
|
||||
RUBY_CHECK_SIZEOF(void*, [int long "long long"], [ILP LP LLP])
|
||||
RUBY_CHECK_SIZEOF(float)
|
||||
|
@ -1577,6 +1578,7 @@ typedef $1 t; int s = sizeof(t) == 42;])],
|
|||
["$ac_cv_sizeof_long"], [ rb_cv_type_$1="m4_if([$3], [], [], [$3 ])long"],
|
||||
["$ac_cv_sizeof_long_long"], [ rb_cv_type_$1="m4_if([$3], [], [], [$3 ])long long"],
|
||||
["$ac_cv_sizeof___int64"], [ rb_cv_type_$1="m4_if([$3], [], [], [$3 ])__int64"],
|
||||
["$ac_cv_sizeof___int128"], [ rb_cv_type_$1="m4_if([$3], [], [], [$3 ])__int128"],
|
||||
[ rb_cv_type_$1=no])])])
|
||||
if test "${rb_cv_type_$1}" != no; then
|
||||
AC_DEFINE([HAVE_]AS_TR_CPP($1), 1)
|
||||
|
|
|
@ -141,7 +141,13 @@ void xfree(void*);
|
|||
# define SIZEOF_LONG_LONG SIZEOF___INT64
|
||||
#endif
|
||||
|
||||
#if SIZEOF_INT*2 <= SIZEOF_LONG_LONG
|
||||
#if defined(HAVE_INT64_T) && defined(HAVE_INT128_T)
|
||||
# define BDIGIT uint64_t
|
||||
# define SIZEOF_BDIGITS SIZEOF_INT64_T
|
||||
# define BDIGIT_DBL uint128_t
|
||||
# define BDIGIT_DBL_SIGNED int128_t
|
||||
# define PRI_BDIGIT_PREFIX PRI_64_PREFIX
|
||||
#elif SIZEOF_INT*2 <= SIZEOF_LONG_LONG
|
||||
# define BDIGIT unsigned int
|
||||
# define SIZEOF_BDIGITS SIZEOF_INT
|
||||
# define BDIGIT_DBL unsigned LONG_LONG
|
||||
|
|
|
@ -115,6 +115,12 @@ typedef char ruby_check_sizeof_voidp[SIZEOF_VOIDP == sizeof(void*) ? 1 : -1];
|
|||
#define PRI_LONG_PREFIX "l"
|
||||
#endif
|
||||
|
||||
#if SIZEOF_LONG == 8
|
||||
#define PRI_64_PREFIX PRI_LONG_PREFIX
|
||||
#elif SIZEOF_LONG_LONG == 8
|
||||
#define PRI_64_PREFIX PRI_LL_PREFIX
|
||||
#endif
|
||||
|
||||
#if defined PRIdPTR && !defined PRI_VALUE_PREFIX
|
||||
#define PRIdVALUE PRIdPTR
|
||||
#define PRIoVALUE PRIoPTR
|
||||
|
|
Loading…
Add table
Reference in a new issue