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

Function midpoint

cranelift/codegen/src/ir/layout.rs:91–96  ·  view source on GitHub ↗

Compute the midpoint between `a` and `b`. Return `None` if the midpoint would be equal to either.

(a: SequenceNumber, b: SequenceNumber)

Source from the content-addressed store, hash-verified

89/// Compute the midpoint between `a` and `b`.
90/// Return `None` if the midpoint would be equal to either.
91fn midpoint(a: SequenceNumber, b: SequenceNumber) -> Option<SequenceNumber> {
92 debug_assert!(a < b);
93 // Avoid integer overflow.
94 let m = a + (b - a) / 2;
95 if m > a { Some(m) } else { None }
96}
97
98impl Layout {
99 /// Compare the program points `a` and `b` in the same block relative to this program order.

Callers 1

assign_inst_seqMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected