diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-18 06:29:51 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-11-18 06:29:51 +0000 |
commit | 81ec47ea185bbf30f42423d25994e479738b483c (patch) | |
tree | 445ed9405053486db7a2ffe45a5a396eeab82c24 /internal.h | |
parent | d9035a8fd46e2fbb944580a33b8138c5dc6dda3b (diff) | |
download | ruby-81ec47ea185bbf30f42423d25994e479738b483c.tar.gz |
internal.h: round macros
* internal.h (ROUND_FUNC, ROUND_CALL): macros wrapping round
functions.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'internal.h')
-rw-r--r-- | internal.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/internal.h b/internal.h index a3ce94988f..31bfbeb8ab 100644 --- a/internal.h +++ b/internal.h @@ -1151,8 +1151,14 @@ enum ruby_num_rounding_mode { RUBY_NUM_ROUND_HALF_EVEN, RUBY_NUM_ROUND_DEFAULT = ROUND_DEFAULT }; -#define ROUND_TO(mode, up, even) \ - ((mode) == RUBY_NUM_ROUND_HALF_EVEN ? even : up) +#define ROUND_TO(mode, even, up) \ + ((mode) == RUBY_NUM_ROUND_HALF_EVEN ? even : \ + up) +#define ROUND_FUNC(mode, name) \ + ROUND_TO(mode, name##_half_even, name##_half_up) +#define ROUND_CALL(mode, name, args) \ + ROUND_TO(mode, name##_half_even args, \ + name##_half_up args) int rb_num_to_uint(VALUE val, unsigned int *ret); VALUE ruby_num_interval_step_size(VALUE from, VALUE to, VALUE step, int excl); |