Skip to content

Commit cab7993

Browse files
committed
Merge pull request TomBebbington#4 from bdash/trunc
Add build_trunc to Builder
2 parents 08b52fb + 722dcc2 commit cab7993

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/builder.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,10 @@ impl Builder {
111111
pub fn build_bit_cast(&self, value: &Value, dest: &Type) -> &Value {
112112
unsafe { core::LLVMBuildBitCast(self.into(), value.into(), dest.into(), NULL_NAME.as_ptr()).into() }
113113
}
114+
/// Build an instruction that truncates the high-order bits of value to fit into a certain type.
115+
pub fn build_trunc(&self, value: &Value, dest: &Type) -> &Value {
116+
unsafe { core::LLVMBuildTrunc(self.into(), value.into(), dest.into(), NULL_NAME.as_ptr()).into() }
117+
}
114118
/// Build an instruction that inserts a value into an aggregate data value.
115119
pub fn build_insert_value(&self, agg: &Value, elem: &Value, index: usize) -> &Value {
116120
unsafe { core::LLVMBuildInsertValue(self.into(), agg.into(), elem.into(), index as c_uint, NULL_NAME.as_ptr()).into() }

0 commit comments

Comments
 (0)