CodeQL library for C/C++
codeql/cpp-all 3.0.1-dev (changelog, source)
Search

Predicate ModulusAnalysis::exprModulus

Holds if e is equal to b + val modulo mod.

There are two cases for the modulus:

  • mod = 0: The equality e = b + val is an ordinary equality.
  • mod > 1: val lies within the range [0 .. mod-1].

Import path

import codeql.rangeanalysis.ModulusAnalysis
predicate exprModulus(Expr e, SemBound b, int val, int mod)