diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-20 10:01:14 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-20 10:01:14 +0000 |
commit | eda90233358d5bed2335900f7977972b1da13882 (patch) | |
tree | 2dc17a5b3f71baaa34316026a244e4f8d86f422a /vm_method.c | |
parent | f11b54213ad169975f98bbf0a39e1b303bc2795f (diff) | |
download | ruby-eda90233358d5bed2335900f7977972b1da13882.tar.gz |
vm_method: set automatically
* vm_method.c (GLOBAL_METHOD_CACHE_MASK): set from
GLOBAL_METHOD_CACHE_SIZE automatically.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_method.c')
-rw-r--r-- | vm_method.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/vm_method.c b/vm_method.c index fce8add6ef..781f95fdcd 100644 --- a/vm_method.c +++ b/vm_method.c @@ -5,8 +5,13 @@ #ifndef GLOBAL_METHOD_CACHE_SIZE #define GLOBAL_METHOD_CACHE_SIZE 0x800 #endif +#define LSB_ONLY(x) ((x) & ~((x) - 1)) +#define POWOR_OF_2_P(x) ((x) == LSB_ONLY(x)) +#if !POWOR_OF_2_P(GLOBAL_METHOD_CACHE_SIZE) +# error GLOBAL_METHOD_CACHE_SIZE must be power of 2 +#endif #ifndef GLOBAL_METHOD_CACHE_MASK -#define GLOBAL_METHOD_CACHE_MASK 0x7ff +#define GLOBAL_METHOD_CACHE_MASK (GLOBAL_METHOD_CACHE_SIZE-1) #endif #define GLOBAL_METHOD_CACHE_KEY(c,m) ((((c)>>3)^(m))&GLOBAL_METHOD_CACHE_MASK) |