-
Notifications
You must be signed in to change notification settings - Fork 6
/
llrb_insn_opt_mod.c
32 lines (31 loc) · 1.02 KB
/
llrb_insn_opt_mod.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "cruby.h"
VALUE
llrb_insn_opt_mod(VALUE recv, VALUE obj)
{
if (FIXNUM_2_P(recv, obj) &&
BASIC_OP_UNREDEFINED_P(BOP_MOD, INTEGER_REDEFINED_OP_FLAG )) {
//if (FIX2LONG(obj) == 0) goto INSN_LABEL(normal_dispatch);
if (FIX2LONG(obj) == 0) return rb_funcall(recv, '%', 1, obj);
return rb_fix_mod_fix(recv, obj);
}
else if (FLONUM_2_P(recv, obj) &&
BASIC_OP_UNREDEFINED_P(BOP_MOD, FLOAT_REDEFINED_OP_FLAG)) {
return DBL2NUM(ruby_float_mod(RFLOAT_VALUE(recv), RFLOAT_VALUE(obj)));
}
//else if (!SPECIAL_CONST_P(recv) && !SPECIAL_CONST_P(obj)) {
// if (RBASIC_CLASS(recv) == rb_cFloat && RBASIC_CLASS(obj) == rb_cFloat &&
// BASIC_OP_UNREDEFINED_P(BOP_MOD, FLOAT_REDEFINED_OP_FLAG)) {
// val = DBL2NUM(ruby_float_mod(RFLOAT_VALUE(recv), RFLOAT_VALUE(obj)));
// }
// else {
// goto INSN_LABEL(normal_dispatch);
// }
//}
else {
//INSN_LABEL(normal_dispatch):
//PUSH(recv);
//PUSH(obj);
//CALL_SIMPLE_METHOD(recv);
}
return rb_funcall(recv, '%', 1, obj);
}