forked from M-Labs/nac3
1
0
Fork 0

Int::const_int to have sign_extend

This commit is contained in:
lyken 2024-08-27 17:26:29 +08:00
parent fdd194ee2a
commit d68760447f
No known key found for this signature in database
GPG Key ID: 3BD5FC6AC8325DD8
1 changed files with 5 additions and 4 deletions

View File

@ -138,8 +138,9 @@ impl<'ctx, N: IntKind<'ctx>> Int<N> {
generator: &mut G, generator: &mut G,
ctx: &'ctx Context, ctx: &'ctx Context,
value: u64, value: u64,
sign_extend: bool,
) -> Instance<'ctx, Self> { ) -> 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) } unsafe { self.believe_value(value) }
} }
@ -157,7 +158,7 @@ impl<'ctx, N: IntKind<'ctx>> Int<N> {
generator: &mut G, generator: &mut G,
ctx: &'ctx Context, ctx: &'ctx Context,
) -> Instance<'ctx, Self> { ) -> Instance<'ctx, Self> {
self.const_int(generator, ctx, 1) self.const_int(generator, ctx, 1, false)
} }
pub fn const_all_ones<G: CodeGenerator + ?Sized>( pub fn const_all_ones<G: CodeGenerator + ?Sized>(
@ -305,7 +306,7 @@ impl Int<Bool> {
generator: &mut G, generator: &mut G,
ctx: &'ctx Context, ctx: &'ctx Context,
) -> Instance<'ctx, Self> { ) -> Instance<'ctx, Self> {
self.const_int(generator, ctx, 0) self.const_int(generator, ctx, 0, false)
} }
#[must_use] #[must_use]
@ -314,7 +315,7 @@ impl Int<Bool> {
generator: &mut G, generator: &mut G,
ctx: &'ctx Context, ctx: &'ctx Context,
) -> Instance<'ctx, Self> { ) -> Instance<'ctx, Self> {
self.const_int(generator, ctx, 1) self.const_int(generator, ctx, 1, false)
} }
} }