#include #include #include "do_jit.h" int main(int argc, char *argv[]) { (void)argv; bool do_jit = argc > 1; struct ejit_operand operands[1] = { EJIT_OPERAND_GPR(1, EJIT_TYPE(unsigned long)) }; struct ejit_func *f = ejit_create_func(EJIT_TYPE(unsigned long), 1, operands); ejit_extr_8(f, EJIT_GPR(0), EJIT_GPR(1)); ejit_retr(f, EJIT_GPR(0)); ejit_select_compile_func(f, 2, 0, EJIT_USE64(unsigned long), do_jit, true); assert(erfi1(f, EJIT_ARG(0, unsigned long)) == 0); assert(erfi1(f, EJIT_ARG(1, unsigned long)) == 1); assert(erfi1(f, EJIT_ARG(0xf, unsigned long)) == 0xf); assert(erfi1(f, EJIT_ARG(0xff, unsigned long)) == -1); assert(erfi1(f, EJIT_ARG(0xfff, unsigned long)) == -1); ejit_destroy_func(f); }