#include #include char b[ 30 ] = {0,}; char *commify( ULONG64 n ) { void *x = memset( b, 0, 30 ); int c1 = sprintf( b, "%I64u", (ULONG64)n ); int c2 = c1; int c = 0; while( ( c1 -= 3 ) > 0 ) { memmove( &b[ c1 + 1 ], &b[ c1 ], c2 - c1 + c ); b[ c1 ] = ','; c++; } return b; } volatile int x; void x1( int i ) { x = i; return; } void x2( int i ) { if( !( i & 1 ) ) return; x = i; return; } int main( int argc, char **argv ) { int n = atol( argv[1] ); int i; ULONG64 start, end; HANDLE hThread = GetCurrentThread(); QueryThreadCycleTime( hThread, &start ); for( i = 0; i < n; ++i ) if( i & 1 ) x1( i ); QueryThreadCycleTime( hThread, &end ); printf( "Inline condition: %15.15s\n", commify( end - start ) ); QueryThreadCycleTime( hThread, &start ); for( i = 0; i < n; ++i ) x2( i ); QueryThreadCycleTime( hThread, &end ); printf( "Inbody condition: %15.15s\n", commify( end - start ) ); return 0; }