mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
SubtractionInCompareToInspectionBase: simplify overflow check
Review ID: IDEA-CR-24978
This commit is contained in:
+2
-10
@@ -140,18 +140,10 @@ public class SubtractionInCompareToInspectionBase extends BaseInspection {
|
||||
long leftMax = leftRange.max();
|
||||
long rightMin = rightRange.min();
|
||||
long rightMax = rightRange.max();
|
||||
if (PsiType.INT.equals(type) &&
|
||||
!overflowsInt(leftMin, rightMin) &&
|
||||
!overflowsInt(leftMin, rightMax) &&
|
||||
!overflowsInt(leftMax, rightMin) &&
|
||||
!overflowsInt(leftMax, rightMax)) {
|
||||
if (PsiType.INT.equals(type) && !overflowsInt(leftMin, rightMax) && !overflowsInt(leftMax, rightMin)) {
|
||||
return true;
|
||||
}
|
||||
if (PsiType.LONG.equals(type) &&
|
||||
!overflowsLong(leftMin, rightMin) &&
|
||||
!overflowsLong(leftMin, rightMax) &&
|
||||
!overflowsLong(leftMax, rightMin) &&
|
||||
!overflowsLong(leftMax, rightMax)) {
|
||||
if (PsiType.LONG.equals(type) && !overflowsLong(leftMin, rightMax) && !overflowsLong(leftMax, rightMin)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user