MCPcopy Create free account
hub / github.com/Amanieu/regalloc3 / intersection

Method intersection

src/internal/live_range.rs:182–191  ·  view source on GitHub ↗

Returns the intersection of two ranges, or `None` if they don't overlap.

(self, other: Self)

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected