mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
f11b54213a
commit
eda9023335
1 changed files with 6 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue