pub fn bitcast(&mut self, x: Value, ty: Type, location: Option<Location>) -> Value {
        let x_ty = x.get_type(self.context);
        assert_ne!(x_ty, ty);
        assert_eq!(x_ty.get_bits(self.context), ty.get_bits(self.context));
        self.make_value(Instruction::BitCast(ty, x, location))
    }
/// Bitcast a value to another type.
///
/// Restrictions:
/// - You cannot cast a value to the same type as it already has.
/// - The type you are casting to must have the same bit-width as the value being casted.
///
///
/// # Examples
///
/// ```
/// # use yair::*;
/// # let mut context = Context::new();
/// # let module = context.create_module().build();
/// # let u32_ty = context.get_uint_type(32);
/// # let i32_ty = context.get_int_type(32);
/// # let function = module.create_function(&mut context).with_name("func").with_return_type(u32_ty).with_arg("a", u32_ty).build();
/// # let block = function.create_block(&mut context).build();
/// # let x = function.get_arg(&context, 0);
/// # let mut instruction_builder = block.create_instructions(&mut context);
/// # let location = None;
/// let cast = instruction_builder.bitcast(x, i32_ty, location);
/// ```
Bitcast a value to another type.
Restrictions:
You cannot cast a value to the same type as it already has.
The type you are casting to must have the same bit-width as the value being casted.
Bitcast a value to another type . Restrictions : You cannot cast a value to the same type as it already has . The type you are casting to must have the same bit - width as the value being casted .
pub fn bitcast(&mut self, x: Value, ty: Type, location: Option<Location>) -> Value {
        let x_ty = x.get_type(self.context);
        assert_ne!(x_ty, ty);
        assert_eq!(x_ty.get_bits(self.context), ty.get_bits(self.context));
        self.make_value(Instruction::BitCast(ty, x, location))
    }
pub fn bitcast ( & mut self , x : Value , ty : Type , location : Option < Location > ) -> Value { let x_ty = x . get_type ( self . context ) ; assert_ne ! ( x_ty ty ) ; assert_eq ! ( x_ty get_bits ( self context ) ty get_bits ( self context ) ) ; self . make_value ( Instruction :: BitCast ( ty , x , location ) ) }
Bitcast a value to another type.
Bitcast a value to another type .
&mut self
x
Value
ty
Type
location
Option<Location>
&mut self
x
Value
ty
Type
location
Option<Location>
examples
None
use yair::*;
None
let mut context = context::new();
None
let module = context.create_module().build();
None
let u32_ty = context.get_uint_type(32);
None
let i32_ty = context.get_int_type(32);
None
let function = module.create_function(&mut context).with_name("func").with_return_type(u32_ty).with_arg("a", u32_ty).build();
None
let block = function.create_block(&mut context).build();
None
let x = function.get_arg(&context, 0);
None
let mut instruction_builder = block.create_instructions(&mut context);
None
let location = none;
let cast = instruction_builder.bitcast(x, i32_ty, location);
```
let cast = instruction_builder . bitcast ( x i32_ty location ) ; ` ` `