MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / from_base_offset

Method from_base_offset

cranelift/codegen/src/ir/sourceloc.rs:66–72  ·  view source on GitHub ↗

Creates a new `RelSourceLoc` based on the given base and offset.

(base: SourceLoc, offset: SourceLoc)

Source from the content-addressed store, hash-verified

64
65 /// Creates a new `RelSourceLoc` based on the given base and offset.
66 pub fn from_base_offset(base: SourceLoc, offset: SourceLoc) -> Self {
67 if base.is_default() || offset.is_default() {
68 Self::default()
69 } else {
70 Self(offset.bits().wrapping_sub(base.bits()))
71 }
72 }
73
74 /// Expands the relative source location into an absolute one, using the given base.
75 pub fn expand(&self, base: SourceLoc) -> SourceLoc {

Callers

nothing calls this directly

Calls 2

is_defaultMethod · 0.45
bitsMethod · 0.45

Tested by

no test coverage detected