Skip to content

Commit 1f5f68e

Browse files
committed
add with compatible type
1 parent c3a0991 commit 1f5f68e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/intrinsic/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
727727
}
728728
else if width == 128 {
729729
// Algorithm from: https://stackoverflow.com/a/28433850/389119 updated to check for high 64bits being 0
730-
let result = self.current_func().new_local(None, self.u32_type, "zeros");
730+
let result = self.current_func().new_local(None, result_type, "zeros");
731731
let ctlz_then_block = self.current_func().new_block("ctlz_then");
732732
let ctlz_else_block = self.current_func().new_block("ctlz_else");
733733
let ctlz_after_block = self.current_func().new_block("ctlz_after");
@@ -755,7 +755,8 @@ impl<'a, 'gcc, 'tcx> Builder<'a, 'gcc, 'tcx> {
755755
let low = self.gcc_int_cast(arg, self.u64_type);
756756
let low_leading_zeroes =
757757
self.gcc_int_cast(self.context.new_call(None, clzll, &[low]), result_type);
758-
let leading_zeroes = self.add(low_leading_zeroes, sixty_four);
758+
let sixty_four_u32 = self.const_uint(result_type, 64);
759+
let leading_zeroes = self.add(low_leading_zeroes, sixty_four_u32);
759760
ctlz_else_block.add_assignment(None, result, leading_zeroes);
760761
ctlz_else_block.end_with_jump(None, ctlz_after_block);
761762

0 commit comments

Comments
 (0)