File path: /jruby-1.4.0/src/org/jruby/RubyBignum.java | File path: /jruby-1.4.0/src/org/jruby/RubyBignum.java | |||
Method name: IRubyObject op_rshift(IRubyObject)
|
Method name: IRubyObject op_lshift(IRubyObject)
|
|||
Number of AST nodes: 20 | Number of AST nodes: 20 | |||
1 | long shift;↵ | 1 | long shift;↵ | |
2 | boolean neg = false;↵ | 2 | boolean neg = false;↵ | |
3 | for (;;) {↵ | 3 | for (;;) {↵ | |
4 | if (other instanceof RubyFixnum) {↵ | 4 | if (other instanceof RubyFixnum) {↵ | |
5 | shift = ((RubyFixnum)other).getLongValue();↵ | 5 | shift = ((RubyFixnum)other).getLongValue();↵ | |
6 | if (shift < 0) {↵ | 6 | if (shift < 0) {↵ | |
7 | neg = true;↵ | 7 | neg = true;↵ | |
8 | shift = -shift;↵ | 8 | shift = -shift;↵ | |
9 | }↵ | 9 | }↵ | |
10 | break;↵ | 10 | break;↵ | |
11 | } else if (other instanceof RubyBignum) {↵ | 11 | } else if (other instanceof RubyBignum) {↵ | |
12 | RubyBignum otherBignum = (RubyBignum)other;↵ | 12 | RubyBignum otherBignum = (RubyBignum)other;↵ | |
13 | if (otherBignum.value.signum() >= 0) {↵ | 13 | if (otherBignum.value.signum() < 0) {↵ | |
14 | IRubyObject tmp = otherBignum.checkShiftDown(this);↵ | 14 | IRubyObject tmp = otherBignum.checkShiftDown(this);↵ | |
15 | if (!tmp.isNil()) return tmp;↵ | 15 | if (!tmp.isNil()) return tmp;↵ | |
16 | } else {↵ | 16 | ↵ | |
17 | neg = true;↵ | 17 | neg = true;↵ | |
18 | }↵ | 18 | }↵ | |
19 | shift = big2long(otherBignum);↵ | 19 | shift = big2long(otherBignum);↵ | |
20 | break;↵ | 20 | break;↵ | |
21 | }↵ | 21 | }↵ | |
22 | other = other.convertToInteger();↵ | 22 | other = other.convertToInteger();↵ | |
23 | }↵ | 23 | }↵ | |
24 | return bignorm(getRuntime(), neg ? value.shiftLeft((int)shift) : value.shiftRight((int)shift)); | 24 | return bignorm(getRuntime(), neg ? value.shiftRight((int)shift) : value.shiftLeft((int)shift)); | |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 2 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 4.8 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 27 |
Number of mapped statements | 3 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 1.5 |
Clone type | Type 1 |
ID | Statement | ID | Statement | |
---|---|---|---|---|
13 | IRubyObject tmp = otherBignum.checkShiftDown(this); | 13 | IRubyObject tmp = otherBignum.checkShiftDown(this); | |
14 | if (!tmp.isNil()) | 14 | if (!tmp.isNil()) | |
15 | return tmp; | 15 | return tmp; |
Row | Violation |
---|
Number of mapped statements | 4 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 2.9 |
Clone type | Type 1 |
ID | Statement | ID | Statement | |
---|---|---|---|---|
5 | shift = ((RubyFixnum)other).getLongValue(); | 5 | shift = ((RubyFixnum)other).getLongValue(); | |
6 | if (shift < 0) | 6 | if (shift < 0) | |
7 | neg = true; | 7 | neg = true; | |
8 | shift = -shift; | 8 | shift = -shift; |
Row | Violation |
---|---|
1 | Clone fragment #1 returns variables shift, neg , while Clone fragment #2 returns variables shift, neg |