Project

General

Profile

Feature #12484 ยป 0001-export-functions.patch

tad (Tadashi Saito), 06/12/2016 12:55 PM

View differences:

internal.h
1104 1104
VALUE rb_dbl_hash(double d);
1105 1105
VALUE rb_fix_plus(VALUE x, VALUE y);
1106 1106
VALUE rb_int_ge(VALUE x, VALUE y);
1107
VALUE rb_int_pow(VALUE x, VALUE y);
1108
VALUE rb_float_pow(VALUE x, VALUE y);
1109
VALUE rb_int_cmp(VALUE x, VALUE y);
1110
VALUE rb_int_equal(VALUE x, VALUE y);
1111
VALUE rb_int_fdiv(VALUE x, VALUE y);
1112
VALUE rb_int_lshift(VALUE x, VALUE y);
1113
VALUE rb_int_div(VALUE x, VALUE y);
1114
VALUE rb_int_abs(VALUE num);
1107 1115

  
1108 1116
#if USE_FLONUM
1109 1117
#define RUBY_BIT_ROTL(v, n) (((v) << (n)) | ((v) >> ((sizeof(v) * 8) - n)))
numeric.c
96 96
static VALUE fix_lshift(long, unsigned long);
97 97
static VALUE fix_rshift(long, unsigned long);
98 98
static VALUE int_pow(long x, unsigned long y);
99
static VALUE int_cmp(VALUE x, VALUE y);
100 99
static int int_round_zero_p(VALUE num, int ndigits);
101 100
VALUE rb_int_floor(VALUE num, int ndigits);
102 101
VALUE rb_int_ceil(VALUE num, int ndigits);
......
1110 1109
 *    2.0**3      #=> 8.0
1111 1110
 */
1112 1111

  
1113
static VALUE
1114
flo_pow(VALUE x, VALUE y)
1112
VALUE
1113
rb_float_pow(VALUE x, VALUE y)
1115 1114
{
1116 1115
    double dx, dy;
1117 1116
    if (RB_TYPE_P(y, T_FIXNUM)) {
......
1869 1868
    h = rb_int_idiv(f, INT2FIX(2));
1870 1869
    r = rb_int_modulo(num, f);
1871 1870
    n = rb_int_minus(num, r);
1872
    r = int_cmp(r, h);
1871
    r = rb_int_cmp(r, h);
1873 1872
    if (FIXNUM_POSITIVE_P(r) || (FIXNUM_ZERO_P(r) && !int_neg_p(num))) {
1874 1873
	n = rb_int_plus(n, f);
1875 1874
    }
......
3383 3382
    }
3384 3383
}
3385 3384

  
3386
static VALUE
3387
int_fdiv(VALUE x, VALUE y)
3385
VALUE
3386
rb_int_fdiv(VALUE x, VALUE y)
3388 3387
{
3389 3388
    if (FIXNUM_P(x)) {
3390 3389
	return fix_fdiv(x, y);
......
3726 3725
    }
3727 3726
}
3728 3727

  
3729
static VALUE
3728
VALUE
3730 3729
rb_int_pow(VALUE x, VALUE y)
3731 3730
{
3732 3731
    if (FIXNUM_P(x)) {
......
3768 3767
    }
3769 3768
}
3770 3769

  
3771
static VALUE
3772
int_equal(VALUE x, VALUE y)
3770
VALUE
3771
rb_int_equal(VALUE x, VALUE y)
3773 3772
{
3774 3773
    if (FIXNUM_P(x)) {
3775 3774
	return fix_equal(x, y);
......
3818 3817
    return rb_num_coerce_cmp(x, y, id_cmp);
3819 3818
}
3820 3819

  
3821
static VALUE
3822
int_cmp(VALUE x, VALUE y)
3820
VALUE
3821
rb_int_cmp(VALUE x, VALUE y)
3823 3822
{
3824 3823
    if (FIXNUM_P(x)) {
3825 3824
	return fix_cmp(x, y);
......
4187 4186
    return LONG2NUM(val);
4188 4187
}
4189 4188

  
4190
static VALUE
4189
VALUE
4191 4190
rb_int_lshift(VALUE x, VALUE y)
4192 4191
{
4193 4192
    if (FIXNUM_P(x)) {
......
4358 4357
    return LONG2NUM(i);
4359 4358
}
4360 4359

  
4361
static VALUE
4362
int_abs(VALUE num)
4360
VALUE
4361
rb_int_abs(VALUE num)
4363 4362
{
4364 4363
    if (FIXNUM_P(num)) {
4365 4364
	return fix_abs(num);
......
4920 4919
    rb_define_method(rb_cInteger, "ceil", int_ceil, -1);
4921 4920
    rb_define_method(rb_cInteger, "truncate", int_truncate, -1);
4922 4921
    rb_define_method(rb_cInteger, "round", int_round, -1);
4923
    rb_define_method(rb_cInteger, "<=>", int_cmp, 1);
4922
    rb_define_method(rb_cInteger, "<=>", rb_int_cmp, 1);
4924 4923

  
4925 4924
    rb_define_method(rb_cInteger, "-@", rb_int_uminus, 0);
4926 4925
    rb_define_method(rb_cInteger, "+", rb_int_plus, 1);
......
4932 4931
    rb_define_method(rb_cInteger, "modulo", rb_int_modulo, 1);
4933 4932
    rb_define_method(rb_cInteger, "remainder", int_remainder, 1);
4934 4933
    rb_define_method(rb_cInteger, "divmod", int_divmod, 1);
4935
    rb_define_method(rb_cInteger, "fdiv", int_fdiv, 1);
4934
    rb_define_method(rb_cInteger, "fdiv", rb_int_fdiv, 1);
4936 4935
    rb_define_method(rb_cInteger, "**", rb_int_pow, 1);
4937 4936

  
4938
    rb_define_method(rb_cInteger, "abs", int_abs, 0);
4939
    rb_define_method(rb_cInteger, "magnitude", int_abs, 0);
4937
    rb_define_method(rb_cInteger, "abs", rb_int_abs, 0);
4938
    rb_define_method(rb_cInteger, "magnitude", rb_int_abs, 0);
4940 4939

  
4941
    rb_define_method(rb_cInteger, "===", int_equal, 1);
4942
    rb_define_method(rb_cInteger, "==", int_equal, 1);
4940
    rb_define_method(rb_cInteger, "===", rb_int_equal, 1);
4941
    rb_define_method(rb_cInteger, "==", rb_int_equal, 1);
4943 4942
    rb_define_method(rb_cInteger, ">", int_gt, 1);
4944 4943
    rb_define_method(rb_cInteger, ">=", rb_int_ge, 1);
4945 4944
    rb_define_method(rb_cInteger, "<", int_lt, 1);
......
5073 5072
    rb_define_method(rb_cFloat, "%", flo_mod, 1);
5074 5073
    rb_define_method(rb_cFloat, "modulo", flo_mod, 1);
5075 5074
    rb_define_method(rb_cFloat, "divmod", flo_divmod, 1);
5076
    rb_define_method(rb_cFloat, "**", flo_pow, 1);
5075
    rb_define_method(rb_cFloat, "**", rb_float_pow, 1);
5077 5076
    rb_define_method(rb_cFloat, "==", flo_eq, 1);
5078 5077
    rb_define_method(rb_cFloat, "===", flo_eq, 1);
5079 5078
    rb_define_method(rb_cFloat, "<=>", flo_cmp, 1);
5080
-