From d68760447f88eb868a6bdff3f1515505e821fe3a Mon Sep 17 00:00:00 2001 From: lyken Date: Tue, 27 Aug 2024 17:26:29 +0800 Subject: [PATCH] Int::const_int to have sign_extend --- nac3core/src/codegen/model/int.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/nac3core/src/codegen/model/int.rs b/nac3core/src/codegen/model/int.rs index db262b28..0059e9b9 100644 --- a/nac3core/src/codegen/model/int.rs +++ b/nac3core/src/codegen/model/int.rs @@ -138,8 +138,9 @@ impl<'ctx, N: IntKind<'ctx>> Int { generator: &mut G, ctx: &'ctx Context, value: u64, + sign_extend: bool, ) -> Instance<'ctx, Self> { - let value = self.llvm_type(generator, ctx).const_int(value, false); + let value = self.llvm_type(generator, ctx).const_int(value, sign_extend); unsafe { self.believe_value(value) } } @@ -157,7 +158,7 @@ impl<'ctx, N: IntKind<'ctx>> Int { generator: &mut G, ctx: &'ctx Context, ) -> Instance<'ctx, Self> { - self.const_int(generator, ctx, 1) + self.const_int(generator, ctx, 1, false) } pub fn const_all_ones( @@ -305,7 +306,7 @@ impl Int { generator: &mut G, ctx: &'ctx Context, ) -> Instance<'ctx, Self> { - self.const_int(generator, ctx, 0) + self.const_int(generator, ctx, 0, false) } #[must_use] @@ -314,7 +315,7 @@ impl Int { generator: &mut G, ctx: &'ctx Context, ) -> Instance<'ctx, Self> { - self.const_int(generator, ctx, 1) + self.const_int(generator, ctx, 1, false) } }