Returns the intersection of two ranges, or `None` if they don't overlap.
(self, other: Self)
| 180 | |
| 181 | /// Returns the intersection of two ranges, or `None` if they don't overlap. |
| 182 | pub fn intersection(self, other: Self) -> Option<Self> { |
| 183 | if other.to <= self.from || other.from >= self.to { |
| 184 | None |
| 185 | } else { |
| 186 | Some(Self { |
| 187 | from: self.from.max(other.from), |
| 188 | to: self.to.min(other.to), |
| 189 | }) |
| 190 | } |
| 191 | } |
| 192 | |
| 193 | /// Number of instructions covered by this live range segment. |
| 194 | pub fn num_insts(self) -> u32 { |
nothing calls this directly
no outgoing calls
no test coverage detected