diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-11-23 13:25:36 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-11-23 13:25:36 +0000 |
commit | 6bcb8edb6deecf7d8d0c93fdcef4c70e72dfead1 (patch) | |
tree | e9936d340c584acec7d779c4e227c38c7862c199 /include/ruby/ruby.h | |
parent | b8bbc1a310b972a9622a2877ab8e0a1ef1fa8e95 (diff) | |
download | ruby-6bcb8edb6deecf7d8d0c93fdcef4c70e72dfead1.tar.gz |
* include/ruby/ruby.h (RBIGNUM_EMBED_LEN_MAX): Limit the value to
less than 8.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include/ruby/ruby.h')
-rw-r--r-- | include/ruby/ruby.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index 3b6a279b5b..35a647110a 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -1067,8 +1067,11 @@ struct RStruct { #define RSTRUCT_SET(st, idx, v) OBJ_WRITE(st, &RSTRUCT_CONST_PTR(st)[idx], (v)) #define RSTRUCT_GET(st, idx) (RSTRUCT_CONST_PTR(st)[idx]) +#define RBIGNUM_EMBED_LEN_NUMBITS 3 #ifndef RBIGNUM_EMBED_LEN_MAX -# define RBIGNUM_EMBED_LEN_MAX ((int)((sizeof(VALUE)*3)/sizeof(BDIGIT))) +# define RBIGNUM_EMBED_LEN_MAX \ + (((int)((sizeof(VALUE)*3)/sizeof(BDIGIT))) < (1 << RBIGNUM_EMBED_LEN_NUMBITS)-1 ? \ + ((int)((sizeof(VALUE)*3)/sizeof(BDIGIT))) : (1 << RBIGNUM_EMBED_LEN_NUMBITS)-1) #endif struct RBignum { struct RBasic basic; @@ -1091,7 +1094,7 @@ struct RBignum { #define RBIGNUM_EMBED_FLAG FL_USER2 #define RBIGNUM_EMBED_LEN_MASK (FL_USER5|FL_USER4|FL_USER3) -#define RBIGNUM_EMBED_LEN_SHIFT (FL_USHIFT+3) +#define RBIGNUM_EMBED_LEN_SHIFT (FL_USHIFT+RBIGNUM_EMBED_LEN_NUMBITS) #define RBIGNUM_LEN(b) \ ((RBASIC(b)->flags & RBIGNUM_EMBED_FLAG) ? \ (long)((RBASIC(b)->flags >> RBIGNUM_EMBED_LEN_SHIFT) & \ |