mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-09 16:39:37 +07:00
Also: define binop widening based on CFG, not on PSI (so loops generated via inliners are also supported) Better squashing GitOrigin-RevId: e1e15652b0363357f6d8dd40c6048e09ae436d09
42 lines
975 B
Java
42 lines
975 B
Java
class Foo {
|
|
// TODO: make not complex
|
|
public static int[] <weak_warning descr="Method 'cells' is complex: data flow results could be imprecise">cells</weak_warning>(int[] start, int[] end) {
|
|
int overlap = 0;
|
|
int gaps = 0;
|
|
for (int i = 0, j = 0; j < end.length; ) {
|
|
if (i < start.length && start[i] < end[j]) {
|
|
overlap++;
|
|
i++;
|
|
} else {
|
|
j++;
|
|
overlap--;
|
|
}
|
|
if (overlap == 0) {
|
|
gaps++;
|
|
}
|
|
}
|
|
int[] cells = new int[gaps * 2];
|
|
overlap = 0;
|
|
gaps = 0;
|
|
int previousOverlap = 0;
|
|
for (int i = 0, j = 0; j < end.length; ) {
|
|
if (i < start.length && start[i] < end[j]) {
|
|
overlap++;
|
|
if (previousOverlap == 0) {
|
|
cells[gaps++] = start[i];
|
|
}
|
|
i++;
|
|
} else {
|
|
overlap--;
|
|
if (overlap == 0) {
|
|
cells[gaps++] = end[j];
|
|
}
|
|
j++;
|
|
}
|
|
previousOverlap = overlap;
|
|
}
|
|
|
|
return cells;
|
|
}
|
|
|
|
} |