diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-08-26 17:53:04 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-10-12 18:19:54 +0900 |
| commit | 2b188ed8a191257f23ddf6f8a27bf1d3964587ed (patch) | |
| tree | bccc235fdf9088a5486201c3855bfb2bfe04a1f2 /mrbgems/mruby-time | |
| parent | 2bb84f1f1ae4bfca49bd92d8d0102a5773d3270f (diff) | |
| download | mruby-2b188ed8a191257f23ddf6f8a27bf1d3964587ed.tar.gz mruby-2b188ed8a191257f23ddf6f8a27bf1d3964587ed.zip | |
Reorganize `Integer` system.
- Integrate `Fixnum` and `Integer`
- Remove `Integral`
- `int / int -> int`
- Replace `mrb_fixnum()` to `mrb_int()`
- Replace `mrb_fixnum_value()` to `mrb_int_value()`.
- Use `mrb_integer_p()` instead of `mrb_fixnum_p()`
Diffstat (limited to 'mrbgems/mruby-time')
| -rw-r--r-- | mrbgems/mruby-time/src/time.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/mrbgems/mruby-time/src/time.c b/mrbgems/mruby-time/src/time.c index 8a4f1d233..2af86b14e 100644 --- a/mrbgems/mruby-time/src/time.c +++ b/mrbgems/mruby-time/src/time.c @@ -218,11 +218,15 @@ typedef mrb_int mrb_sec; (sizeof(time_t) <= 4 ? INT32_MAX : INT64_MAX) \ ) +/* return true if time_t is fit in mrb_int */ static mrb_bool fixable_time_t_p(time_t v) { if (MRB_INT_MIN <= MRB_TIME_MIN && MRB_TIME_MAX <= MRB_INT_MAX) return TRUE; - return FIXABLE(v); + if (v > (time_t)MRB_INT_MAX) return FALSE; + if (MRB_TIME_T_UINT) return TRUE; + if (MRB_INT_MIN > (mrb_int)v) return FALSE; + return TRUE; } static time_t @@ -880,11 +884,6 @@ mrb_time_usec(mrb_state *mrb, mrb_value self) struct mrb_time *tm; tm = time_get_ptr(mrb, self); -#ifndef MRB_NO_FLOAT - if (!fixable_time_t_p(tm->usec)) { - return mrb_float_value(mrb, (mrb_float)tm->usec); - } -#endif return mrb_fixnum_value((mrb_int)tm->usec); } |
