From 0224b515a8decf0359a17635830f91cd558300bd Mon Sep 17 00:00:00 2001 From: akr Date: Sun, 24 Nov 2013 09:15:34 +0000 Subject: [PATCH] * include/ruby/defines.h (SIZEOF_ACTUAL_BDIGIT): Defined. * include/ruby/ruby.h (RBIGNUM_EMBED_LEN_MAX): Use SIZEOF_ACTUAL_BDIGIT instead of SIZEOF_BDIGITS. SIZEOF_BDIGITS can be different to sizeof(BDIGIT). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ include/ruby/defines.h | 4 ++++ include/ruby/ruby.h | 4 ++-- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index cb01a365d4..a9f8874b46 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Sun Nov 24 18:13:23 2013 Tanaka Akira + + * include/ruby/defines.h (SIZEOF_ACTUAL_BDIGIT): Defined. + + * include/ruby/ruby.h (RBIGNUM_EMBED_LEN_MAX): Use + SIZEOF_ACTUAL_BDIGIT instead of SIZEOF_BDIGITS. + SIZEOF_BDIGITS can be different to sizeof(BDIGIT). + Sun Nov 24 13:49:08 2013 Tanaka Akira * include/ruby/defines.h: Don't use int128_t for Bignum. diff --git a/include/ruby/defines.h b/include/ruby/defines.h index 1c07ac07e8..9659db7ef6 100644 --- a/include/ruby/defines.h +++ b/include/ruby/defines.h @@ -168,12 +168,16 @@ void xfree(void*); # else # define BDIGIT unsigned short # define SIZEOF_BDIGITS (SIZEOF_LONG/2) +# define SIZEOF_ACTUAL_BDIGIT SIZEOF_LONG # define BDIGIT_DBL unsigned long # define BDIGIT_DBL_SIGNED long # define PRI_BDIGIT_PREFIX "h" # define PRI_BDIGIT_DBL_PREFIX "l" # endif #endif +#ifndef SIZEOF_ACTUAL_BDIGIT +# define SIZEOF_ACTUAL_BDIGIT SIZEOF_BDIGITS +#endif #ifdef PRI_BDIGIT_PREFIX # define PRIdBDIGIT PRI_BDIGIT_PREFIX"d" diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index 66ef47c464..69e0d6a829 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -1069,8 +1069,8 @@ struct RStruct { #define RBIGNUM_EMBED_LEN_NUMBITS 3 #ifndef RBIGNUM_EMBED_LEN_MAX -# if (SIZEOF_VALUE*3/SIZEOF_BDIGITS) < (1 << RBIGNUM_EMBED_LEN_NUMBITS)-1 -# define RBIGNUM_EMBED_LEN_MAX (SIZEOF_VALUE*3/SIZEOF_BDIGITS) +# if (SIZEOF_VALUE*3/SIZEOF_ACTUAL_BDIGIT) < (1 << RBIGNUM_EMBED_LEN_NUMBITS)-1 +# define RBIGNUM_EMBED_LEN_MAX (SIZEOF_VALUE*3/SIZEOF_ACTUAL_BDIGIT) # else # define RBIGNUM_EMBED_LEN_MAX ((1 << RBIGNUM_EMBED_LEN_NUMBITS)-1) # endif