File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -54,9 +54,12 @@ object Periods {
5454
5555 /** Does this period contain the given period? */
5656 def contains (that : Period ): Boolean =
57- this .runId == that.runId &&
58- this .firstPhaseId <= that.firstPhaseId &&
59- that.lastPhaseId <= this .lastPhaseId
57+ // We want to check (run1 == run2) & (last1 >= last2) & (first1 <= first2).
58+ // We can do the first two comparisons in one by checking if subtracting code1 from code2 leads to all-zeroes
59+ // in the sign + run ID bits. If (run1 > run2) or (run2 < run1) or (run1 == run2 and last1 < last2),
60+ // then (code1 - code2) is either large enough to have some run ID bits set, or negative so the sign bit is set.
61+ ((this .code - that.code) & (- 1 << (PhaseWidth * 2 ))) == 0 &&
62+ this .firstPhaseId <= that.firstPhaseId
6063
6164 /** Does this period overlap with given period? */
6265 def overlaps (that : Period ): Boolean =
You can’t perform that action at this time.
0 commit comments