diff options
author | 卜部昌平 <[email protected]> | 2020-04-08 13:28:13 +0900 |
---|---|---|
committer | GitHub <[email protected]> | 2020-04-08 13:28:13 +0900 |
commit | 9e6e39c3512f7a962c44dc3729c98a0f8be90341 (patch) | |
tree | 901a22676d54d78240e450b64a8cd06eb1703910 /numeric.c | |
parent | 5ac4bf2cd87e1eb5779ca5ae7f96a1a22e8436d9 (diff) |
Merge pull request #2991 from shyouhei/ruby.h
Split ruby.h
Notes
Notes:
Merged-By: shyouhei <[email protected]>
Diffstat (limited to 'numeric.c')
-rw-r--r-- | numeric.c | 20 |
1 files changed, 16 insertions, 4 deletions
@@ -9,7 +9,7 @@ **********************************************************************/ -#include "ruby/config.h" +#include "ruby/3/config.h" #include <assert.h> #include <ctype.h> @@ -906,7 +906,7 @@ rb_float_new_in_heap(double d) NEWOBJ_OF(flt, struct RFloat, rb_cFloat, T_FLOAT | (RGENGC_WB_PROTECTED_FLOAT ? FL_WB_PROTECTED : 0)); flt->float_value = d; - OBJ_FREEZE(flt); + OBJ_FREEZE((VALUE)flt); return (VALUE)flt; } @@ -1433,7 +1433,7 @@ flo_hash(VALUE num) static VALUE rb_dbl_hash(double d) { - return LONG2FIX(rb_dbl_long_hash(d)); + return ST2FIX(rb_dbl_long_hash(d)); } VALUE @@ -2929,7 +2929,6 @@ rb_num2ulong(VALUE val) return rb_num2ulong_internal(val, NULL); } -#if SIZEOF_INT < SIZEOF_LONG void rb_out_of_int(SIGNED_VALUE num) { @@ -2937,6 +2936,7 @@ rb_out_of_int(SIGNED_VALUE num) num, num < 0 ? "small" : "big"); } +#if SIZEOF_INT < SIZEOF_LONG static void check_int(long num) { @@ -3013,6 +3013,18 @@ rb_fix2int(VALUE val) { return FIX2INT(val); } + +unsigned long +rb_num2uint(VALUE val) +{ + return rb_num2ulong(val); +} + +unsigned long +rb_fix2uint(VALUE val) +{ + return RB_FIX2ULONG(val); +} #endif NORETURN(static void rb_out_of_short(SIGNED_VALUE num)); |