Repository: dotnet/runtime
File: src/coreclr/jit/rangecheck.h (C/C++)

Code before:
        {
            return result;
        }

        // Check lo ranges if they are dependent and not unknown.
        if (r1lo.IsDependent())
        {
            result.lLimit = Limit(Limit::keDependent);
        }
        else if (r1lo.IsConstant())
        {
            result.lLimit = ShiftRightConstantLimit(r1lo, r2lo);
        }

        if (r1hi.IsDependent())
        {
            result.uLimit = Limit(Limit::keDependent);
        }
        else if (r1hi.IsConstant())
        {
            result.uLimit = ShiftRightConstantLimit(r1hi, r2hi);
        }

        return result;
    }

    // Given two ranges "r1" and "r2", perform an multiply operation on the
    // ranges.
    static Range Multiply(Range& r1, Range& r2)
    {
        Limit& r1lo = r1.LowerLimit();
        Limit& r1hi = r1.UpperLimit();
        Limit& r2lo = r2.LowerLimit();
        Limit& r2hi = r2.UpperLimit();

        Range result = Limit(Limit::keUnknown);

        // Check lo ranges if they are dependent and not unknown.
        if ((r1lo.IsDependent() && !r1lo.IsUnknown()) || (r2lo.IsDependent() && !r2lo.IsUnknown()))
        {
            result.lLimit = Limit(Limit::keDependent);
        }
        // Check hi ranges if they are dependent and not unknown.
        if ((r1hi.IsDependent() && !r1hi.IsUnknown()) || (r2hi.IsDependent() && !r2hi.IsUnknown()))
        {
            result.uLimit = Limit(Limit::keDependent);
        }

        if (r1lo.IsConstant())
        {
            result.lLimit = MultiplyConstantLimit(r2lo, r1lo);

Review comment (suggestion):
The lambda parameters should be `const Limit&` instead of `Limit&` to match the signature of `SubtractConstantLimit`, which takes `const Limit&` parameters. This avoids unnecessary copies and matches the const-correctness of the underlying function.
```suggestion
        return ApplyRangeOp(r1, r2, [](const Limit& a, const Limit& b) {
            return AddConstantLimit(a, b);
        });
    }

    static Range Subtract(Range& r1, Range& r2)
    {
        return ApplyRangeOp(r1, r2, [](const Limit& a, const Limit& b) {
            return SubtractConstantLimit(a, b);
        });
    }

    static Range Multiply(Range& r1, Range& r2)
    {
        return ApplyRangeOp(r1, r2, [](const Limit& a, const Limit& b) {
```

Code after:
        }
        if (r2hi.IsConstant())
        {
            result.uLimit = op(r1hi, r2hi);
        }

        return result;
    }

    static Range Add(Range& r1, Range& r2)
    {
        return ApplyRangeOp(r1, r2, [](Limit& a, Limit& b) {
            return AddConstantLimit(a, b);
        });
    }

    static Range Subtract(Range& r1, Range& r2)
    {
        return ApplyRangeOp(r1, r2, [](Limit& a, Limit& b) {
            return SubtractConstantLimit(a, b);
        });
    }

    static Range Multiply(Range& r1, Range& r2)
    {
        return ApplyRangeOp(r1, r2, [](Limit& a, Limit& b) {
            return MultiplyConstantLimit(a, b);
        });
    }

    static Range ShiftRight(Range& r1, Range& r2)
    {
        Limit& r1lo = r1.LowerLimit();
        Limit& r1hi = r1.UpperLimit();
        Limit& r2lo = r2.LowerLimit();
        Limit& r2hi = r2.UpperLimit();

        Range result = Limit(Limit::keUnknown);

        // For now we only support r1 >> positive_cns (to simplify)
        if (!r2lo.IsConstant() || !r2hi.IsConstant() || (r2lo.cns < 0) || (r2hi.cns < 0))
        {
            return result;
        }

        // Check lo ranges if they are dependent and not unknown.
        if (r1lo.IsDependent())
        {
            result.lLimit = Limit(Limit::keDependent);
        }
        else if (r1lo.IsConstant())