Function set_alignment

Source
pub fn set_alignment(val: &ValueRef, bytes: u32)
Expand description

Set the preferred alignment of the value.

§Details

Sets the alignment for a global value in bytes.

This function wraps the LLVMSetAlignment function from the LLVM core library. It specifies the alignment requirement for the global value represented by ValueRef, in terms of the number of bytes. Proper alignment can be important for performance, particularly in low-level systems programming, where misaligned accesses can cause performance penalties or even hardware exceptions.

§Parameters

  • bytes: A u32 value representing the desired alignment in bytes. This value must be a power of two.