summaryrefslogtreecommitdiff
path: root/internal/hash.h
diff options
context:
space:
mode:
authorPeter Zhu <[email protected]>2023-04-19 16:16:27 -0400
committerPeter Zhu <[email protected]>2023-05-17 09:19:40 -0400
commitcea9c30fa549885e36471f1782359df2bdcf895a ()
treeb004d05c75af965c0bd4202f3ddcbe0b04de895c /internal/hash.h
parent0938964ba1af3924cf969fb809fc3598892bc20d (diff)
Move ar_hint to ar_table_struct
This allows Hashes with ST tables to fit int he 80 byte size pool.
Notes: Merged: https://.com/ruby/ruby/pull/7742
-rw-r--r--internal/hash.h14
1 files changed, 4 insertions, 10 deletions
@@ -46,6 +46,10 @@ typedef struct ar_table_pair_struct {
} ar_table_pair;
typedef struct ar_table_struct {
/* 64bit CPU: 8B * 2 * 8 = 128B */
ar_table_pair pairs[RHASH_AR_TABLE_MAX_SIZE];
} ar_table;
@@ -53,20 +57,10 @@ typedef struct ar_table_struct {
struct RHash {
struct RBasic basic;
const VALUE ifnone;
- union {
- ar_hint_t ary[RHASH_AR_TABLE_MAX_SIZE];
- VALUE word;
- } ar_hint;
};
#define RHASH(obj) ((struct RHash *)(obj))
-#ifndef MAX
-# define MAX(a, b) (((a) > (b)) ? (a) : (b))
-#endif
-
-#define RHASH_SLOT_SIZE (sizeof(struct RHash) + MAX(sizeof(ar_table), sizeof(st_table)))
-
#ifdef RHASH_IFNONE
# undef RHASH_IFNONE
#endif