forked from M-Labs/nac3
1
0
Fork 0

array use i64_type().const_int for GEP

This commit is contained in:
lyken 2024-08-28 12:16:55 +08:00
parent d12fb99ded
commit 40aa27c42c
No known key found for this signature in database
GPG Key ID: 3BD5FC6AC8325DD8
1 changed files with 2 additions and 2 deletions

View File

@ -90,7 +90,7 @@ impl<'ctx, Len: ArrayLen, Item: Model<'ctx>> Instance<'ctx, Ptr<Array<Len, Item>
ctx: &CodeGenContext<'ctx, '_>, ctx: &CodeGenContext<'ctx, '_>,
i: IntValue<'ctx>, i: IntValue<'ctx>,
) -> Instance<'ctx, Ptr<Item>> { ) -> Instance<'ctx, Ptr<Item>> {
let zero = ctx.ctx.i32_type().const_zero(); let zero = ctx.ctx.i64_type().const_zero();
let ptr = unsafe { ctx.builder.build_in_bounds_gep(self.value, &[zero, i], "").unwrap() }; let ptr = unsafe { ctx.builder.build_in_bounds_gep(self.value, &[zero, i], "").unwrap() };
unsafe { Ptr(self.model.0.item).believe_value(ptr) } unsafe { Ptr(self.model.0.item).believe_value(ptr) }
@ -104,7 +104,7 @@ impl<'ctx, Len: ArrayLen, Item: Model<'ctx>> Instance<'ctx, Ptr<Array<Len, Item>
self.model.0.len.length() self.model.0.len.length()
); );
let i = ctx.ctx.i32_type().const_int(i, false); let i = ctx.ctx.i64_type().const_int(i, true);
self.gep(ctx, i) self.gep(ctx, i)
} }