mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-08 21:52:48 +07:00
GitOrigin-RevId: 7be0773a57aabc503f7a44360b0d0de40eee2c00
64 lines
2.1 KiB
Java
64 lines
2.1 KiB
Java
import java.util.*;
|
|
|
|
public class LongRangeDivShift {
|
|
private static final long[] UNITS = new long[]{1, 60, 60 * 60};
|
|
|
|
public static void processTime(long time) {
|
|
if (time < 1000 * UNITS[0]) {
|
|
return;
|
|
}
|
|
long divRes = time / 1000;
|
|
for (int i = UNITS.length - 1; i >= 0; i--) {
|
|
if (divRes < UNITS[i]) {}
|
|
}
|
|
}
|
|
|
|
void test(int[] arr, int x) {
|
|
if(<warning descr="Condition 'arr.length / 2 < 0' is always 'false'">arr.length / 2 < 0</warning>) {
|
|
System.out.println("Impossible");
|
|
}
|
|
}
|
|
|
|
void signTest(int x, int y) {
|
|
if(<warning descr="Condition 'x > 0 && y < 0 && x/y > 0' is always 'false'">x > 0 && y < 0 && <warning descr="Condition 'x/y > 0' is always 'false'">x/y > 0</warning></warning>) {
|
|
System.out.println("Impossible");
|
|
}
|
|
}
|
|
|
|
void shift(long x) {
|
|
long a = x >> 32;
|
|
if(<warning descr="Condition 'a < Integer.MIN_VALUE || a > Integer.MAX_VALUE' is always 'false'"><warning descr="Condition 'a < Integer.MIN_VALUE' is always 'false'">a < Integer.MIN_VALUE</warning> || <warning descr="Condition 'a > Integer.MAX_VALUE' is always 'false' when reached">a > Integer.MAX_VALUE</warning></warning>) {
|
|
System.out.println("Impossible");
|
|
}
|
|
}
|
|
|
|
void shiftUnsigned(int x) {
|
|
x = x >>> 16;
|
|
if(<warning descr="Condition 'x >= 0 && x <= 0xFFFF' is always 'true'"><warning descr="Condition 'x >= 0' is always 'true'">x >= 0</warning> && <warning descr="Condition 'x <= 0xFFFF' is always 'true' when reached">x <= 0xFFFF</warning></warning>) {
|
|
char c = (char)x;
|
|
}
|
|
}
|
|
|
|
static final int RESIZE_STAMP_SHIFT = 16;
|
|
static final int MAX_RESIZERS = 65535;
|
|
|
|
void testCHM(int sc, int rs) {
|
|
if (sc < 0) {
|
|
if ((sc >>> RESIZE_STAMP_SHIFT) != rs || <warning descr="Condition 'sc == rs + 1' is always 'false'">sc == rs + 1</warning> ||
|
|
<warning descr="Condition 'sc == rs + MAX_RESIZERS' is always 'false'">sc == rs + MAX_RESIZERS</warning>) {}
|
|
}
|
|
}
|
|
|
|
void testPolyadicDiv() {
|
|
int a = 0;
|
|
double res = 1 / a / -2;
|
|
}
|
|
|
|
void testUnboxDiv(Object obj, int divisor) {
|
|
if (obj instanceof Integer) {
|
|
int val = (Integer)obj;
|
|
int res = val / divisor;
|
|
}
|
|
}
|
|
}
|