diff options
Diffstat (limited to 'variable.c')
-rw-r--r-- | variable.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/variable.c b/variable.c index 4b8c87bd1f..8c802082c2 100644 --- a/variable.c +++ b/variable.c @@ -1434,10 +1434,11 @@ rb_ensure_generic_iv_list_size(VALUE obj, uint32_t newsize) return ivtbl; } +// @note May raise when there are too many instance variables. void rb_init_iv_list(VALUE obj) { - uint32_t newsize = rb_shape_get_shape(obj)->iv_count * 2.0; + uint32_t newsize = (uint32_t)(rb_shape_get_shape(obj)->iv_count * 2.0); uint32_t len = ROBJECT_NUMIV(obj); rb_ensure_iv_list_size(obj, len, newsize < len ? len : newsize); } @@ -1467,7 +1468,7 @@ rb_obj_ensure_iv_index_mapping(VALUE obj, ID id) uint32_t len = ROBJECT_NUMIV(obj); if (len <= index) { - uint32_t newsize = (shape->iv_count + 1) * 1.25; + uint32_t newsize = (uint32_t)((shape->iv_count + 1) * 1.25); rb_ensure_iv_list_size(obj, len, newsize); } RUBY_ASSERT(index <= ROBJECT_NUMIV(obj)); |