ruby-changes:31750
From: akr <ko1@a...>
Date: Sun, 24 Nov 2013 18:15:40 +0900 (JST)
Subject: [ruby-changes:31750] akr:r43829 (trunk): * include/ruby/defines.h (SIZEOF_ACTUAL_BDIGIT): Defined.
akr 2013-11-24 18:15:34 +0900 (Sun, 24 Nov 2013) New Revision: 43829 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43829 Log: * 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). Modified files: trunk/ChangeLog trunk/include/ruby/defines.h trunk/include/ruby/ruby.h Index: include/ruby/defines.h =================================================================== --- include/ruby/defines.h (revision 43828) +++ include/ruby/defines.h (revision 43829) @@ -168,12 +168,16 @@ void xfree(void*); https://github.com/ruby/ruby/blob/trunk/include/ruby/defines.h#L168 # 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" Index: include/ruby/ruby.h =================================================================== --- include/ruby/ruby.h (revision 43828) +++ include/ruby/ruby.h (revision 43829) @@ -1069,8 +1069,8 @@ struct RStruct { https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1069 #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 Index: ChangeLog =================================================================== --- ChangeLog (revision 43828) +++ ChangeLog (revision 43829) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sun Nov 24 18:13:23 2013 Tanaka Akira <akr@f...> + + * 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 <akr@f...> * include/ruby/defines.h: Don't use int128_t for Bignum. -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/