C++: Minor refactor and documentation tweak to simple range analysis

This commit is contained in:
Simon Friis Vindum
2025-01-13 12:15:09 +01:00
parent 0c9ee4d029
commit dcdc43933b

View File

@@ -769,7 +769,7 @@ private float getLowerBoundsImpl(Expr expr) {
exists(float x, float y |
x = getFullyConvertedLowerBounds(maxExpr.getLeftOperand()) and
y = getFullyConvertedLowerBounds(maxExpr.getRightOperand()) and
if x >= y then result = x else result = y
result = x.maximum(y)
)
)
or
@@ -979,7 +979,7 @@ private float getUpperBoundsImpl(Expr expr) {
exists(float x, float y |
x = getFullyConvertedUpperBounds(minExpr.getLeftOperand()) and
y = getFullyConvertedUpperBounds(minExpr.getRightOperand()) and
if x <= y then result = x else result = y
result = x.minimum(y)
)
)
or
@@ -1152,10 +1152,7 @@ private float getUpperBoundsImpl(Expr expr) {
not expr instanceof SimpleRangeAnalysisExpr
or
// A modeled expression for range analysis
exists(SimpleRangeAnalysisExpr rangeAnalysisExpr |
rangeAnalysisExpr = expr and
result = rangeAnalysisExpr.getUpperBounds()
)
result = expr.(SimpleRangeAnalysisExpr).getUpperBounds()
}
/**
@@ -1606,7 +1603,7 @@ private module SimpleRangeAnalysisCached {
* the lower bound of the expression after all the casts have been applied,
* call `lowerBound` like this:
*
* `lowerBound(expr.getFullyConverted())`
* lowerBound(expr.getFullyConverted())
*/
cached
float lowerBound(Expr expr) {
@@ -1625,7 +1622,7 @@ private module SimpleRangeAnalysisCached {
* the upper bound of the expression after all the casts have been applied,
* call `upperBound` like this:
*
* `upperBound(expr.getFullyConverted())`
* upperBound(expr.getFullyConverted())
*/
cached
float upperBound(Expr expr) {