forked from M-Labs/nac3
core/model: fix Ptr::copy_from int types
This commit is contained in:
parent
7e45c104be
commit
9e005e9b07
@ -175,8 +175,16 @@ impl<'ctx, Item: Model<'ctx>> Instance<'ctx, Ptr<Item>> {
|
||||
source: Self,
|
||||
num_items: IntValue<'ctx>,
|
||||
) {
|
||||
let llvm_usize = generator.get_size_type(ctx.ctx);
|
||||
|
||||
// Force extend `num_items` and `itemsize` so their types would match.
|
||||
let itemsize = self.model.sizeof(generator, ctx.ctx);
|
||||
let totalsize = ctx.builder.build_int_mul(itemsize, num_items, "totalsize").unwrap(); // TODO: Int types may not match.
|
||||
let itemsize =
|
||||
ctx.builder.build_int_z_extend_or_bit_cast(itemsize, llvm_usize, "").unwrap();
|
||||
let num_items =
|
||||
ctx.builder.build_int_z_extend_or_bit_cast(num_items, llvm_usize, "").unwrap();
|
||||
|
||||
let totalsize = ctx.builder.build_int_mul(itemsize, num_items, "totalsize").unwrap();
|
||||
|
||||
let is_volatile = ctx.ctx.bool_type().const_zero(); // is_volatile = false
|
||||
call_memcpy_generic(ctx, self.value, source.value, totalsize, is_volatile);
|
||||
|
Loading…
Reference in New Issue
Block a user