static void wmain_code(void *_data, fncode fn) { struct whiledata *wdata = _data; loop_body(wdata, fn); branch(OPmba3, wdata->looplab, fn); }
int main() { std::cout << "Pre window init" << std::endl; window.init(); std::cout << "Pre render init" << std::endl; render.init(); input.init(); bool shouldExit = false; input.onExit([&shouldExit](){shouldExit=true;}); std::cout << "pre loop" << std::endl; #ifdef EMSCRIPTEN emscripten_set_main_loop(loop_body, 15, true); #else while( !shouldExit) { loop_body(); } #endif // EMSCRIPTEN return 0; }
int main(int argc, char** argv) { for(int i = 0; i < 32; i++) { registers[i] = getV<VW>(); } loop_body(); double acc = 0; for(int i = 0; i < ROUNDS; i++) { for(int j = 0; j < VL; j++) { interp(); acc += registers[ret_val][0]; } } printf("Result: %f\n", acc / (ROUNDS * VW * VL)); return 0; }
void generate_dowhile(component iteration, component condition, const char *continue_label, bool discard, fncode fn) { struct whiledata wdata; start_block(NULL, FALSE, discard, fn); wdata.continue_label = continue_label; wdata.looplab = new_label(fn); wdata.mainlab = new_label(fn); wdata.endlab = new_label(fn); wdata.code = iteration; wdata.next = NULL; loop_body(&wdata, fn); generate_condition(condition, wdata.mainlab, NULL, NULL, wdata.endlab, NULL, NULL, fn); set_label(wdata.endlab, fn); if (!discard) generate_component(component_undefined, NULL, FALSE, fn); end_block(fn); }
void f(Args&&...args) { do_in_order([&](){loop_body(std::forward<Args>(args));}...); }