Ptr::offset_const offset i64, can be negative
This commit is contained in:
parent
d68760447f
commit
baf8ee2b3d
|
@ -114,9 +114,9 @@ impl<'ctx, Item: Model<'ctx>> Instance<'ctx, Ptr<Item>> {
|
|||
pub fn offset_const(
|
||||
&self,
|
||||
ctx: &CodeGenContext<'ctx, '_>,
|
||||
offset: u64,
|
||||
offset: i64,
|
||||
) -> Instance<'ctx, Ptr<Item>> {
|
||||
let offset = ctx.ctx.i32_type().const_int(offset, false);
|
||||
let offset = ctx.ctx.i32_type().const_int(offset as u64, true);
|
||||
self.offset(ctx, offset)
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,7 @@ impl<'ctx, Item: Model<'ctx>> Instance<'ctx, Ptr<Item>> {
|
|||
pub fn set_index_const(
|
||||
&self,
|
||||
ctx: &CodeGenContext<'ctx, '_>,
|
||||
index: u64,
|
||||
index: i64,
|
||||
value: Instance<'ctx, Item>,
|
||||
) {
|
||||
self.offset_const(ctx, index).store(ctx, value);
|
||||
|
@ -151,7 +151,7 @@ impl<'ctx, Item: Model<'ctx>> Instance<'ctx, Ptr<Item>> {
|
|||
&self,
|
||||
generator: &mut G,
|
||||
ctx: &CodeGenContext<'ctx, '_>,
|
||||
index: u64,
|
||||
index: i64,
|
||||
) -> Instance<'ctx, Item> {
|
||||
self.offset_const(ctx, index).load(generator, ctx)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue