fix examples/tests with proper addressing
This commit is contained in:
parent
88c25b6361
commit
6b7144133f
|
@ -90,12 +90,12 @@ impl Externals for TestHost {
|
||||||
Ok(Some(result))
|
Ok(Some(result))
|
||||||
}
|
}
|
||||||
ERR_FUNC_INDEX => {
|
ERR_FUNC_INDEX => {
|
||||||
let error_code = args.nth::<i32>(0)? as u32;
|
let error_code: u32 = args.nth(0)?;
|
||||||
let error = HostErrorWithCode { error_code };
|
let error = HostErrorWithCode { error_code };
|
||||||
Err(Error::Host(Box::new(error)))
|
Err(Error::Host(Box::new(error)))
|
||||||
}
|
}
|
||||||
INC_MEM_FUNC_INDEX => {
|
INC_MEM_FUNC_INDEX => {
|
||||||
let ptr = args.nth::<i32>(0)? as u32;
|
let ptr: u32 = args.nth(0)?;
|
||||||
|
|
||||||
let memory = self.memory.as_ref().expect(
|
let memory = self.memory.as_ref().expect(
|
||||||
"Function 'inc_mem' expects attached memory",
|
"Function 'inc_mem' expects attached memory",
|
||||||
|
@ -108,7 +108,7 @@ impl Externals for TestHost {
|
||||||
Ok(None)
|
Ok(None)
|
||||||
}
|
}
|
||||||
GET_MEM_FUNC_INDEX => {
|
GET_MEM_FUNC_INDEX => {
|
||||||
let ptr = args.nth::<i32>(0)? as u32;
|
let ptr: u32 = args.nth(0)?;
|
||||||
|
|
||||||
let memory = self.memory.as_ref().expect(
|
let memory = self.memory.as_ref().expect(
|
||||||
"Function 'get_mem' expects attached memory",
|
"Function 'get_mem' expects attached memory",
|
||||||
|
@ -466,7 +466,7 @@ fn defer_providing_externals() {
|
||||||
) -> Result<Option<RuntimeValue>, Error> {
|
) -> Result<Option<RuntimeValue>, Error> {
|
||||||
match index {
|
match index {
|
||||||
INC_FUNC_INDEX => {
|
INC_FUNC_INDEX => {
|
||||||
let a = args.nth::<i32>(0)? as u32;
|
let a = args.nth::<u32>(0)?;
|
||||||
*self.acc += a;
|
*self.acc += a;
|
||||||
Ok(None)
|
Ok(None)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue