mirror of
https://github.com/libretro/cpp-cheat.git
synced 2025-04-08 22:41:01 +00:00
29 lines
438 B
C
29 lines
438 B
C
/*
|
|
Measure the performance of each call with: TODO
|
|
|
|
http://igoro.com/archive/fast-and-slow-if-statements-branch-prediction-in-modern-processors/
|
|
*/
|
|
|
|
#include "common.h"
|
|
|
|
const long N = 1000000000;
|
|
|
|
void f(long p) {
|
|
long sum = 0;
|
|
for (long i = 0; i < N; i++)
|
|
if (!(i & p))
|
|
sum++;
|
|
}
|
|
|
|
int main() {
|
|
f(INT_MIN);
|
|
f(-1);
|
|
f(1);
|
|
f(2);
|
|
f(3);
|
|
f(4);
|
|
f(8);
|
|
f(16);
|
|
return EXIT_SUCCESS;
|
|
}
|