nanowasm/src/op/control_flow/br_if.c

30 lines
486 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)
{
varuint32 relative_depth;
if (varuint32_read(f, &relative_depth))
{
LOG("%s: varuint32_read failed\n", __func__);
return 1;
}
return 0;
}
int op_br_if(struct nw_interp *const i)
{
return op(i, i->f);
}
int check_br_if(FILE *const f)
{
return op(NULL, f);
}