int main(int argc, char *argv[]) { jit_node_t *nc, *nf; pifi c2f, f2c; int i; init_jit(argv[0]); _jit = jit_new_state(); nc = compile_rpn("32x9*5/+"); nf = compile_rpn("x32-5*9/"); (void)jit_emit(); c2f = (pifi)jit_address(nc); f2c = (pifi)jit_address(nf); jit_clear_state(); printf("\nC:"); for (i = 0; i <= 100; i += 10) printf("%3d ", i); printf("\nF:"); for (i = 0; i <= 100; i += 10) printf("%3d ", c2f(i)); printf("\n"); printf("\nF:"); for (i = 32; i <= 212; i += 18) printf("%3d ", i); printf("\nC:"); for (i = 32; i <= 212; i += 18) printf("%3d ", f2c(i)); printf("\n"); jit_destroy_state(); finish_jit(); return 0; }
int main () { pdfd c2f, f2c; double i; codeBuffer = mmap(NULL, getpagesize(), PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANON, -1, 0); if (codeBuffer == MAP_FAILED) { perror("mmap"); exit(0); } regs[0] = JIT_FPR0; regs[1] = JIT_FPR1; regs[2] = JIT_FPR2; regs[3] = JIT_FPR3; regs[4] = JIT_FPR4; regs[5] = JIT_FPR5; jit_set_ip (codeBuffer); c2f = compile_rpn ("9*5/32+"); f2c = compile_rpn ("32-5*9/"); #ifndef LIGHTNING_CROSS printf ("\nC:"); for (i = 0; i <= 100; i += 10) printf ("%6.1f", i); printf ("\nF:"); for (i = 0; i <= 100; i += 10) printf ("%6.1f", c2f (i)); printf ("\n"); printf ("\nF:"); for (i = 32; i <= 212; i += 10) printf ("%6.1f", i); printf ("\nC:"); for (i = 32; i <= 212; i += 10) printf ("%6.1f", f2c (i)); printf ("\n"); #endif return 0; }
int main () { pifi c2f, f2c; int i; codeBuffer = mmap(NULL, getpagesize(), PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANON, -1, 0); if (codeBuffer == MAP_FAILED) { perror("mmap"); exit(0); } jit_set_ip (codeBuffer); c2f = compile_rpn ("32 x 9 * 5 / +"); f2c = compile_rpn ("5 x 32_ + * 9 /"); #ifndef LIGHTNING_CROSS printf ("\nC:"); for (i = 0; i <= 100; i += 10) printf ("%3d ", i); printf ("\nF:"); for (i = 0; i <= 100; i += 10) printf ("%3d ", c2f (i)); printf ("\n"); printf ("\nF:"); for (i = 32; i <= 212; i += 10) printf ("%3d ", i); printf ("\nC:"); for (i = 32; i <= 212; i += 10) printf ("%3d ", f2c (i)); printf ("\n"); #endif return 0; }