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

Function align_to

winch/codegen/src/abi/mod.rs:646–657  ·  view source on GitHub ↗

Align a value up to the given power-of-two-alignment. See https://sites.google.com/site/theoryofoperatingsystems/labs/malloc/align8

(value: N, alignment: N)

Source from the content-addressed store, hash-verified

644/// Align a value up to the given power-of-two-alignment.
645// See https://sites.google.com/site/theoryofoperatingsystems/labs/malloc/align8
646pub(crate) fn align_to<N>(value: N, alignment: N) -> N
647where
648 N: Not<Output = N>
649 + BitAnd<N, Output = N>
650 + Add<N, Output = N>
651 + Sub<N, Output = N>
652 + From<u8>
653 + Copy,
654{
655 let alignment_mask = alignment - 1.into();
656 (value + alignment_mask) & !alignment_mask
657}
658
659/// Calculates the delta needed to adjust a function's frame plus some
660/// addend to a given alignment.

Callers 7

zero_mem_rangeMethod · 0.50
to_abi_operandMethod · 0.50
callMethod · 0.50
to_abi_operandMethod · 0.50
callMethod · 0.50
newMethod · 0.50
abi_arg_slotMethod · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected