File path: /jruby-1.4.0/src/org/jruby/util/Convert.java | File path: /jruby-1.4.0/src/org/jruby/util/Convert.java | |||
Method name: double byteArrayToDouble(byte[], int, int, boolean)
|
Method name: double byteArrayToDouble(byte[], int, int, boolean)
|
|||
Number of AST nodes: 28 | Number of AST nodes: 27 | |||
1 | if (i < buflen) {↵ | |||
2 | switch(ival = bytes[i++]) {↵ | 1 | switch(ival = bytes[i++]) {↵ | |
3 | case '0':↵ | 2 | case '0':↵ | |
4 | if (nDigits > 0) {↵ | 3 | if (nDigits > 0) {↵ | |
5 | nTrailingZeroes++;↵ | 4 | nTrailingZeroes++;↵ | |
6 | } else {↵ | 5 | } else {↵ | |
7 | exponent--;↵ | 6 | exponent--;↵ | |
8 | }↵ | 7 | }↵ | |
9 | break; // switch↵ | 8 | break; // switch↵ | |
10 | case '1': case '2': case '3': case '4':↵ | 9 | case '1': case '2': case '3': case '4':↵ | |
11 | case '5': case '6': case '7': case '8': case '9':↵ | 10 | case '5': case '6': case '7': case '8': case '9':↵ | |
12 | if (nTrailingZeroes > 0) {↵ | 11 | if (nTrailingZeroes > 0) {↵ | |
13 | if ((nDigits += nTrailingZeroes) < MAX_DECIMAL_DIGITS) {↵ | 12 | if ((nDigits += nTrailingZeroes) < MAX_DECIMAL_DIGITS) {↵ | |
14 | significand *= LONG_10_POWERS[nTrailingZeroes];↵ | 13 | significand *= LONG_10_POWERS[nTrailingZeroes];↵ | |
15 | nTrailingZeroes = 0;↵ | 14 | nTrailingZeroes = 0;↵ | |
16 | } // else catch oversize below↵ | 15 | } // else catch oversize below↵ | |
17 | }↵ | 16 | }↵ | |
18 | if (nDigits++ < MAX_DECIMAL_DIGITS) {↵ | 17 | if (nDigits++ < MAX_DECIMAL_DIGITS) {↵ | |
19 | significand = significand*10L + (long)((int)ival-(int)'0');↵ | 18 | significand = significand*10L + (long)((int)ival-(int)'0');↵ | |
20 | break; // switch↵ | 19 | break; // switch↵ | |
21 | } else {↵ | 20 | } else {↵ | |
22 | state = SDIGIT;↵ | 21 | state = SDIGIT;↵ | |
23 | break states;↵ | 22 | break states;↵ | |
24 | }↵ | 23 | }↵ | |
25 | default:↵ | 24 | default:↵ | |
26 | // no dec digits, end of parseable data, go to calc↵ | 25 | // no dec digits after '.', error for strict↵ | |
27 | state = SOPTCALC;↵ | 26 | state = SERR_NOT_STRICT;↵ | |
28 | break states;↵ | 27 | break states;↵ | |
29 | ↵ | 28 | ↵ | |
30 | } // switch↵ | 29 |
| |
31 | } | |||
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 2.6 |
Clones location | Clones are in the same method |
Number of node comparisons | 172 |
Number of mapped statements | 27 |
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) | 43.8 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
127 | switch (ival = bytes[i++]) | 323 | switch (ival = bytes[i++]) | |||||||||||
128 | case '0': | 324 | case '0': | |||||||||||
129 | if (nDigits > 0) | 325 | if (nDigits > 0) | |||||||||||
130 | nTrailingZeroes++; | 326 | nTrailingZeroes++; | |||||||||||
else | else | |||||||||||||
131 | exponent--; | 327 | exponent--; | |||||||||||
132 | break; | 328 | break; | |||||||||||
133 | case '1': | 329 | case '1': | |||||||||||
134 | case '2': | 330 | case '2': | |||||||||||
135 | case '3': | 331 | case '3': | |||||||||||
136 | case '4': | 332 | case '4': | |||||||||||
137 | case '5': | 333 | case '5': | |||||||||||
138 | case '6': | 334 | case '6': | |||||||||||
139 | case '7': | 335 | case '7': | |||||||||||
140 | case '8': | 336 | case '8': | |||||||||||
141 | case '9': | 337 | case '9': | |||||||||||
142 | if (nTrailingZeroes > 0) | 338 | if (nTrailingZeroes > 0) | |||||||||||
143 | if ((nDigits += nTrailingZeroes) < MAX_DECIMAL_DIGITS) | 339 | if ((nDigits += nTrailingZeroes) < MAX_DECIMAL_DIGITS) | |||||||||||
144 | significand *= LONG_10_POWERS[nTrailingZeroes]; | 340 | significand *= LONG_10_POWERS[nTrailingZeroes]; | |||||||||||
145 | nTrailingZeroes = 0; | 341 | nTrailingZeroes = 0; | |||||||||||
146 | if (nDigits++ < MAX_DECIMAL_DIGITS) | 342 | if (nDigits++ < MAX_DECIMAL_DIGITS) | |||||||||||
147 | significand = significand * 10L + (long)((int)ival - (int)'0'); | 343 | significand = significand * 10L + (long)((int)ival - (int)'0'); | |||||||||||
148 | break; | 344 | break; | |||||||||||
else | else | |||||||||||||
149 | state = SDIGIT; | 345 | state = SDIGIT; | |||||||||||
150 | break states; | 346 | break states; | |||||||||||
151 | default: | 347 | default: | |||||||||||
152 | state = SOPTCALC; |
| 348 | state = SERR_NOT_STRICT; | ||||||||||
153 | break states; | 349 | break states; |
Row | Violation |
---|---|
1 | Clone fragment #1 returns variables i, ival, nDigits, nTrailingZeroes, significand, exponent , while Clone fragment #2 returns variables i, ival, nDigits, nTrailingZeroes, significand, exponent |