diff options
| author | dearblue <[email protected]> | 2020-07-21 23:55:26 +0900 |
|---|---|---|
| committer | dearblue <[email protected]> | 2020-07-24 11:42:37 +0900 |
| commit | 5c2b11d21581cf472929b21f28f1a388a16f0865 (patch) | |
| tree | 516c537e872d644980b014dd8a4ac09cb597f06b /src/variable.c | |
| parent | c9ba761b9e23e720da9200be1c4df103a04e51b2 (diff) | |
| download | mruby-5c2b11d21581cf472929b21f28f1a388a16f0865.tar.gz mruby-5c2b11d21581cf472929b21f28f1a388a16f0865.zip | |
Avoid using FPU with `mruby-os-memsize`; ref #5032
And, in the calculation of the instance variable size, the fraction was
always rounded down because of division of integers, so fix it.
At the same time, test items that are no longer passed due to this
change are deleted.
Diffstat (limited to 'src/variable.c')
| -rw-r--r-- | src/variable.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/variable.c b/src/variable.c index 0755f7d92..8c16b2d4f 100644 --- a/src/variable.c +++ b/src/variable.c @@ -4,7 +4,6 @@ ** See Copyright Notice in mruby.h */ -#include <math.h> #include <mruby.h> #include <mruby/array.h> #include <mruby/class.h> @@ -1132,9 +1131,9 @@ mrb_class_find_path(mrb_state *mrb, struct RClass *c) mrb_int mrb_obj_iv_tbl_memsize(mrb_state* mrb, mrb_value obj) { - return sizeof(iv_tbl) + - (sizeof(segment) * ceil(iv_size(mrb, mrb_obj_ptr(obj)->iv)/ - MRB_IV_SEGMENT_SIZE)); + size_t ivsize = iv_size(mrb, mrb_obj_ptr(obj)->iv); + size_t ivsegs = (ivsize + MRB_IV_SEGMENT_SIZE - 1) / MRB_IV_SEGMENT_SIZE; + return sizeof(iv_tbl) + (sizeof(segment) * ivsegs); } #define identchar(c) (ISALNUM(c) || (c) == '_' || !ISASCII(c)) |
