nanowasm/src/op/memory/current_memory.c

36 lines
656 B
C

#include <log.h>
#include <ops.h>
#include <nanowasm/nw.h>
#include <wasm_types.h>
#include <stddef.h>
#include <stdio.h>
static int op(struct nw_interp *const i, FILE *const f)
{
varuint1 reserved;
if (varuint1_read(f, &reserved))
{
LOG("%s: varuint1_read failed\n", __func__);
return 1;
}
else if (reserved)
{
LOG("%s: unexpected non-zero reserved value %u\n",
__func__, (unsigned)reserved);
return 1;
}
return 0;
}
int op_current_memory(struct nw_interp *const i, FILE *const f)
{
return op(i, f);
}
int check_current_memory(FILE *const f)
{
return op(NULL, f);
}