Use pointer::add instead of pointer::offset with a cast.

This commit is contained in:
Dan Gohman
2019-11-08 16:22:41 -08:00
parent 39b0d670c5
commit 5b0031ece8
3 changed files with 5 additions and 10 deletions

View File

@@ -460,13 +460,13 @@ pub unsafe extern "C" fn wasm_func_call(
let func = (*func).func.borrow();
let mut params = Vec::with_capacity(func.param_arity());
for i in 0..func.param_arity() {
let val = &(*args.offset(i as isize));
let val = &(*args.add(i));
params.push(val.val());
}
match func.call(&params) {
Ok(out) => {
for i in 0..func.result_arity() {
let val = &mut (*results.offset(i as isize));
let val = &mut (*results.add(i));
*val = wasm_val_t::from_val(&out[i]);
}
ptr::null_mut()
@@ -666,7 +666,7 @@ pub unsafe extern "C" fn wasm_instance_new(
let store = &(*store).store;
let mut externs: Vec<Extern> = Vec::with_capacity((*module).imports.len());
for i in 0..(*module).imports.len() {
let import = *imports.offset(i as isize);
let import = *imports.add(i);
externs.push((*import).ext.clone());
}
let module = &(*module).module;