static void BM_dotprod(benchmark::State &state) { size_t n = 1 * 2048; short *vec1 = bench_calloc<short>(n); short *vec2 = bench_calloc<short>(n); int sum = 0; while (state.KeepRunning()) { sum += AA_dotprod(vec1, vec2, n); } blackhole(vec1); blackhole(vec2); blackhole(sum); }
void display_loop(){ // mcuf_serial_mode(); mode = setjmp(newmode_jmpbuf); #ifdef JOYSTICK_SUPPORT // in case we get here via mode jump, we (re)enable joystick queries waitForFire = 1; #endif oldOldmode = oldMode; #ifdef JOYSTICK_SUPPORT waitForFire = 1; #endif for(;;){ #ifndef MENU_SUPPORT clear_screen(0); #endif oldMode = mode; switch(mode++) { #ifdef ANIMATION_SCROLLTEXT case 1: scrolltext(scrolltext_text); #ifdef RANDOM_SUPPORT { char a[28]; sprintf(a,"</# counter == %lu ", (unsigned long)percnt_get(&g_reset_counter, &g_reset_counter_idx)); scrolltext(a); } #endif #endif #ifdef ANIMATION_TIME #ifndef ANIMATION_SCROLLTEXT case 1: #endif time_anim(); break; #else #ifdef ANIMATION_SCROLLTEXT break; #endif #endif #ifdef ANIMATION_SPIRAL # ifndef SPIRAL_DELAY # define SPIRAL_DELAY 5 # endif case 2: spiral(SPIRAL_DELAY); break; #endif #ifdef ANIMATION_JOERN1 case 3: joern1(); break; #endif #ifdef ANIMATION_SNAKE case 4: snake_animation(); break; #endif #ifdef ANIMATION_CHECKERBOARD case 5: checkerboard(20); break; #endif #ifdef ANIMATION_FIRE case 6: fire(); break; #endif #ifdef ANIMATION_TIME case 7: time_anim(); break; #endif #ifdef ANIMATION_MATRIX case 8: matrix(); break; #endif #ifdef ANIMATION_RANDOM_BRIGHT case 9: random_bright(30); break; #endif #ifdef ANIMATION_STONEFLY case 10: stonefly(); break; #endif #ifdef ANIMATION_GAMEOFLIFE case 11: gameoflife(); break; #endif #ifdef ANIMATION_FLYINGDOTS case 12: flyingdots(); break; #endif #ifdef ANIMATION_BREAKOUT case 13: breakout_demo(); break; #endif #ifdef ANIMATION_MHERWEG case 14: mherweg(); break; #endif #ifdef ANIMATION_MOIRE case 15: moire(); break; #endif #ifdef ANIMATION_TIME case 16: time_anim(); break; #endif #ifdef ANIMATION_LTN_ANT case 17: ltn_ant(); break; #endif #ifdef ANIMATION_LABORLOGO case 18: laborlogo(); break; #endif #ifdef ANIMATION_AMPHIBIAN case 19: amphibian(); break; #endif #ifdef ANIMATION_LOGO_OOS case 20: logo_OutOfSpec(); break; #endif #ifdef ANIMATION_FAIRYDUST case 21: fairydust(); break; #endif #ifdef ANIMATION_PLASMA case 22: plasma(); break; #endif #ifdef ANIMATION_PSYCHEDELIC case 23: psychedelic(); break; #endif #ifdef ANIMATION_BLACKHOLE case 24: blackhole(); break; #endif #ifdef ANIMATION_SQUARES case 25: squares(); break; #endif #ifdef ANIMATION_DNA case 26: dna(); break; #endif #ifdef ANIMATION_TESTS case 31: test_level(1, false); break; case 32: test_level(2, false); break; case 33: test_level(3, false); break; case 35: test_palette(false); test_palette2(false); break; #endif #ifdef SMALLANIMATION_ROWWALK case 36: rowwalk(SMALLANIMATION_ROWWALK_COUNT,SMALLANIMATION_ROWWALK_SPEED); break; #endif #ifdef SMALLANIMATION_COLWALK case 37: colwalk(SMALLANIMATION_COLWALK_COUNT,SMALLANIMATION_COLWALK_SPEED); break; #endif #ifdef SMALLANIMATION_COLBOUNCE case 38: colbounce(SMALLANIMATION_COLBOUNCE_COUNT,SMALLANIMATION_COLBOUNCE_SPEED); break; #endif #ifdef SMALLANIMATION_ROWBOUNCE case 39: rowbounce(SMALLANIMATION_ROWBOUNCE_COUNT,SMALLANIMATION_ROWBOUNCE_SPEED); break; #endif #ifdef MENU_SUPPORT case 0xFDu: mode = 1; break; case 0xFEu: menu(); mode = oldOldmode; break; #else case 0xFDu: #ifdef JOYSTICK_SUPPORT if (JOYISFIRE) mode = 0xFEu; else #endif mode = 1; break; case 0xFEu: #ifdef JOYSTICK_SUPPORT waitForFire = 0; // avoid circular jumps while (JOYISFIRE); // wait until user released the fire button #endif wait(25); // wait for button to settle # ifdef GAME_TETRIS tetris(); # endif # ifdef GAME_BASTET tetris_bastet(); # endif # ifdef GAME_TETRIS_FP tetris_fp(); # endif # ifdef GAME_SPACE_INVADERS borg_invaders(); # endif # ifdef GAME_SNAKE snake_game(); # endif # ifdef GAME_BREAKOUT borg_breakout(0); # endif #ifdef JOYSTICK_SUPPORT while (JOYISFIRE); // avoid an unwanted restart of the game loop #endif wait(25); // wait for button to settle mode = oldOldmode; // restore old animation mode #ifdef JOYSTICK_SUPPORT waitForFire = 1; // reenable joystick query of the wait() function #endif break; #endif #ifdef ANIMATION_OFF case 0xFFu: off(); break; #endif default: if (reverseMode) { if (reverseMode-- == (mode - 1)) { mode -= 2; } else { reverseMode = 0; } } break; } } }