зеркало из https://github.com/github/ruby.git
Make variation_count an unsigned char
Since SHAPE_MAX_VARIATIONS is 8, it can easily fit inside an unsigned char.
This commit is contained in:
Родитель
a468213917
Коммит
d86833e717
|
@ -11,6 +11,7 @@
|
|||
#include "id_table.h" /* for struct rb_id_table */
|
||||
#include "internal/gc.h" /* for RB_OBJ_WRITE */
|
||||
#include "internal/serial.h" /* for rb_serial_t */
|
||||
#include "internal/static_assert.h"
|
||||
#include "ruby/internal/stdbool.h" /* for bool */
|
||||
#include "ruby/intern.h" /* for rb_alloc_func_t */
|
||||
#include "ruby/ruby.h" /* for struct RBasic */
|
||||
|
@ -25,6 +26,7 @@ struct rb_subclass_entry {
|
|||
struct rb_subclass_entry *next;
|
||||
struct rb_subclass_entry *prev;
|
||||
};
|
||||
typedef struct rb_subclass_entry rb_subclass_entry_t;
|
||||
|
||||
struct rb_cvar_class_tbl_entry {
|
||||
uint32_t index;
|
||||
|
@ -52,12 +54,15 @@ struct rb_classext_struct {
|
|||
const VALUE refined_class;
|
||||
rb_alloc_func_t allocator;
|
||||
const VALUE includer;
|
||||
uint32_t max_iv_count;
|
||||
uint32_t variation_count;
|
||||
#if !SHAPE_IN_BASIC_FLAGS
|
||||
shape_id_t shape_id;
|
||||
#endif
|
||||
uint32_t max_iv_count;
|
||||
unsigned char variation_count;
|
||||
};
|
||||
typedef struct rb_classext_struct rb_classext_t;
|
||||
|
||||
STATIC_ASSERT(shape_max_variations, SHAPE_MAX_VARIATIONS < (1 << (sizeof(((rb_classext_t *)0)->variation_count) * CHAR_BIT)));
|
||||
|
||||
struct RClass {
|
||||
struct RBasic basic;
|
||||
|
|
Загрузка…
Ссылка в новой задаче