diff --git a/nac3core/src/codegen/numpy.rs b/nac3core/src/codegen/numpy.rs index 58869f2c4f..c3631f5644 100644 --- a/nac3core/src/codegen/numpy.rs +++ b/nac3core/src/codegen/numpy.rs @@ -800,7 +800,8 @@ fn ndarray_from_ndlist_impl<'ctx, G: CodeGenerator + ?Sized>( _ => { let lst_len = src_lst.load_size(ctx, None); let sizeof_elem = dst_arr.get_type().element_type().size_of().unwrap(); - let sizeof_elem = ctx.builder.build_int_cast(sizeof_elem, llvm_usize, "").unwrap(); + let sizeof_elem = + ctx.builder.build_int_z_extend_or_bit_cast(sizeof_elem, llvm_usize, "").unwrap(); let cpy_len = ctx .builder @@ -1207,7 +1208,7 @@ fn ndarray_sliced_copyto_impl<'ctx, G: CodeGenerator + ?Sized>( .build_int_mul( src_data_offset, ctx.builder - .build_int_cast(sizeof_elem, src_data_offset.get_type(), "") + .build_int_z_extend_or_bit_cast(sizeof_elem, src_data_offset.get_type(), "") .unwrap(), "", ) @@ -1220,7 +1221,7 @@ fn ndarray_sliced_copyto_impl<'ctx, G: CodeGenerator + ?Sized>( .build_int_mul( dst_data_offset, ctx.builder - .build_int_cast(sizeof_elem, dst_data_offset.get_type(), "") + .build_int_z_extend_or_bit_cast(sizeof_elem, dst_data_offset.get_type(), "") .unwrap(), "", ) diff --git a/nac3core/src/codegen/values/ndarray.rs b/nac3core/src/codegen/values/ndarray.rs index 38c6a98049..e3e2256402 100644 --- a/nac3core/src/codegen/values/ndarray.rs +++ b/nac3core/src/codegen/values/ndarray.rs @@ -131,8 +131,10 @@ impl<'ctx> NDArrayValue<'ctx> { elem_ty: BasicTypeEnum<'ctx>, size: IntValue<'ctx>, ) { - let itemsize = - ctx.builder.build_int_cast(elem_ty.size_of().unwrap(), size.get_type(), "").unwrap(); + let itemsize = ctx + .builder + .build_int_z_extend_or_bit_cast(elem_ty.size_of().unwrap(), size.get_type(), "") + .unwrap(); let nbytes = ctx.builder.build_int_mul(size, itemsize, "").unwrap(); // TODO: What about alignment?