Skip to content

Commit cfb2f0a

Browse files
committed
Address review comments
1 parent 449e377 commit cfb2f0a

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

shared/util/codeql/util/UnboundList.qll

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ module Make<LocationSig Location, InputSig<Location> Input> {
5353
/** Gets the rank of element `e`, which is used internally in the string encoding. */
5454
int getRank(Element e) { e = DenseRank<DenseRankInput>::denseRank(result) }
5555

56+
/** Gets the ASCII printable excluding `.` with zero-based index `code`. */
5657
pragma[nomagic]
5758
private string interpretAsciiCode(int code) {
5859
exists(int dot, int c |
@@ -65,14 +66,18 @@ module Make<LocationSig Location, InputSig<Location> Input> {
6566

6667
private int asciiCodes() { result = strictcount(interpretAsciiCode(_)) }
6768

69+
/**
70+
* Gets the `i`th digit (modulo `asciiCodes()`) in a base-`asciiCodes()` integer
71+
* representation of `getRank(e)`.
72+
*/
6873
private int getAsciiCodePart(Element e, int i) {
6974
result = getRank(e) and
7075
i = 0
7176
or
7277
exists(int mid |
7378
mid = getAsciiCodePart(e, i - 1) and
74-
mid > 0 and
75-
result = mid / asciiCodes()
79+
result = mid / asciiCodes() and
80+
result > 0
7681
)
7782
}
7883

0 commit comments

Comments
 (0)