forked from M-Labs/nac3
core: fix __nac3_ndarray_calc_size crash due to incorrect typing
This commit is contained in:
parent
56fa2b6803
commit
0744b938b8
|
@ -201,7 +201,7 @@ double __nac3_j0(double x) {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t __nac3_ndarray_calc_size(
|
uint32_t __nac3_ndarray_calc_size(
|
||||||
const uint64_t *list_data,
|
const uint32_t *list_data,
|
||||||
uint32_t list_len,
|
uint32_t list_len,
|
||||||
uint32_t begin_idx,
|
uint32_t begin_idx,
|
||||||
uint32_t end_idx
|
uint32_t end_idx
|
||||||
|
@ -210,7 +210,7 @@ uint32_t __nac3_ndarray_calc_size(
|
||||||
|
|
||||||
uint32_t num_elems = 1;
|
uint32_t num_elems = 1;
|
||||||
for (uint32_t i = begin_idx; i < end_idx; ++i) {
|
for (uint32_t i = begin_idx; i < end_idx; ++i) {
|
||||||
uint64_t val = list_data[i];
|
uint32_t val = list_data[i];
|
||||||
__builtin_assume(val > 0);
|
__builtin_assume(val > 0);
|
||||||
num_elems *= val;
|
num_elems *= val;
|
||||||
}
|
}
|
||||||
|
|
|
@ -579,10 +579,8 @@ where
|
||||||
G: CodeGenerator + ?Sized,
|
G: CodeGenerator + ?Sized,
|
||||||
Dims: ArrayLikeIndexer<'ctx>,
|
Dims: ArrayLikeIndexer<'ctx>,
|
||||||
{
|
{
|
||||||
let llvm_i64 = ctx.ctx.i64_type();
|
|
||||||
let llvm_usize = generator.get_size_type(ctx.ctx);
|
let llvm_usize = generator.get_size_type(ctx.ctx);
|
||||||
|
let llvm_pusize = llvm_usize.ptr_type(AddressSpace::default());
|
||||||
let llvm_pi64 = llvm_i64.ptr_type(AddressSpace::default());
|
|
||||||
|
|
||||||
let ndarray_calc_size_fn_name = match llvm_usize.get_bit_width() {
|
let ndarray_calc_size_fn_name = match llvm_usize.get_bit_width() {
|
||||||
32 => "__nac3_ndarray_calc_size",
|
32 => "__nac3_ndarray_calc_size",
|
||||||
|
@ -590,7 +588,7 @@ where
|
||||||
bw => unreachable!("Unsupported size type bit width: {}", bw),
|
bw => unreachable!("Unsupported size type bit width: {}", bw),
|
||||||
};
|
};
|
||||||
let ndarray_calc_size_fn_t = llvm_usize.fn_type(
|
let ndarray_calc_size_fn_t = llvm_usize.fn_type(
|
||||||
&[llvm_pi64.into(), llvm_usize.into(), llvm_usize.into(), llvm_usize.into()],
|
&[llvm_pusize.into(), llvm_usize.into(), llvm_usize.into(), llvm_usize.into()],
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
let ndarray_calc_size_fn =
|
let ndarray_calc_size_fn =
|
||||||
|
|
Loading…
Reference in New Issue