#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(long)) }; struct ejit_func *f = ejit_create_func(EJIT_TYPE(long), 1, operands); ejit_extr_u32(f, EJIT_GPR(0), EJIT_GPR(1)); ejit_retr(f, EJIT_GPR(0)); /* true since extr_u32 only exists on 64bit arches */ ejit_select_compile_func(f, 2, 0, true, do_jit); assert(erfi1(f, EJIT_ARG(0, long)) == 0); assert(erfi1(f, EJIT_ARG(1, long)) == 1); assert(erfi1(f, EJIT_ARG(0xffffffff, long)) == (long)0xffffffff); assert(erfi1(f, EJIT_ARG(0xfffffffff, long)) == (long)0xffffffff); assert(erfi1(f, EJIT_ARG(0xf00000000, long)) == 0); ejit_destroy_func(f); }