pub fn const_bit_cast(val: &ValueRef, to_type: &TypeRef) -> ValueRef
Expand description
Perform a bitcast operation on a constant value to the specified type.
§Details
Performs a constant bitcast of a value to another type without changing the bit representation.
This function wraps the LLVMConstBitCast
function from the LLVM core library. It generates a constant
bitcast instruction, which reinterprets the value represented by ValueRef
as another type specified by to_type
.
The bitcast does not change the underlying bit representation of the value; it merely reinterprets it as a different type.
This is typically used for converting between types of the same size, such as casting between integers and pointers or between different floating-point types.
§Parameters
to_type
: A reference to the target type (TypeRef
) to which the value should be cast. This type must have the same bit width as the original type.
§Returns
Returns an instance of ValueRef
, which encapsulates the result of the bitcast. The result is a constant value
determined at compile time, representing the value reinterpreted as the target type.