Skip to content

Commit ed87f25

Browse files
committed
CPP: Performance improvement.
1 parent 695d4ff commit ed87f25

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

cpp/ql/src/semmle/code/cpp/commons/Printf.qll

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -844,14 +844,10 @@ class FormatLiteral extends Literal {
844844
*/
845845
int getFormatArgumentIndexFor(int n, int mode) {
846846
hasFormatArgumentIndexFor(n, mode) and
847-
result = count(int n2, int mode2 |
848-
hasFormatArgumentIndexFor(n2, mode2) and
849-
(
850-
n2 < n
851-
or
852-
n2 = n and
853-
mode2 < mode
854-
)
847+
(3 * n) + mode = rank[result + 1](int n2, int mode2 |
848+
hasFormatArgumentIndexFor(n2, mode2)
849+
|
850+
(3 * n2) + mode2
855851
)
856852
}
857853

0 commit comments

Comments
 (0)