Skip to content

Commit 722dcc2

Browse files
committed
Add build_trunc to Builder.
1 parent 80c49e0 commit 722dcc2

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
@@ -114,6 +114,10 @@ impl Builder {
114114
pub fn build_bit_cast(&self, value: &Value, dest: &Type) -> &Value {
115115
unsafe { core::LLVMBuildBitCast(self.into(), value.into(), dest.into(), NULL_NAME.as_ptr()).into() }
116116
}
117+
/// Build an instruction that truncates the high-order bits of value to fit into a certain type.
118+
pub fn build_trunc(&self, value: &Value, dest: &Type) -> &Value {
119+
unsafe { core::LLVMBuildTrunc(self.into(), value.into(), dest.into(), NULL_NAME.as_ptr()).into() }
120+
}
117121
/// Build an instruction that inserts a value into an aggregate data value.
118122
pub fn build_insert_value(&self, agg: &Value, elem: &Value, index: usize) -> &Value {
119123
unsafe { core::LLVMBuildInsertValue(self.into(), agg.into(), elem.into(), index as c_uint, NULL_NAME.as_ptr()).into() }

0 commit comments

Comments
 (0)