Fixed divide by zero bug.

svn path=/trunk/boinc/; revision=111
This commit is contained in:
Eric Heien 2002-06-12 19:24:45 +00:00
parent daf5dbc03b
commit 88f05d8a3e
1 changed files with 14 additions and 14 deletions

View File

@ -320,34 +320,34 @@ clock_t int_op_test( int iterations, int print_debug ) {
for( i=1;i<NUM_INTS;i++ ) { for( i=1;i<NUM_INTS;i++ ) {
a[i] = 2*a[i-1]; a[i] = 2*a[i-1];
} }
time_start = clock(); time_start = clock();
for( i=0;i<iterations;i++ ) { for( i=0;i<iterations;i++ ) {
for( j=0;j<I_LOOP_ITERS/(NUM_INTS*8);j++ ) { for( j=0;j<I_LOOP_ITERS/(NUM_INTS*9);j++ ) {
for( k=0;k<NUM_INTS;k++ ) { for( k=0;k<NUM_INTS;k++ ) {
a[k] *= 3; // 2 int ops a[k] *= 3; // 1 int ops
} }
for( k=NUM_INTS-1;k>=0;k-- ) { for( k=NUM_INTS-1;k>=0;k-- ) {
a[k] += 6; // 2 int ops a[k] += 6; // 2 int ops
} }
for( k=0;k<NUM_INTS;k++ ) { for( k=0;k<NUM_INTS;k++ ) {
a[k] /= 3; // 2 int ops a[k] /= 3; // 3 int ops
} }
for( k=NUM_INTS-1;k>=0;k-- ) { for( k=NUM_INTS-1;k>=0;k-- ) {
a[k] -= 2; // 2 int ops a[k] -= 2; // 4 int ops
}
//for( k=NUM_INTS-1;k>0;k-- ) {
// a[k] -= a[k-1];
//}
for( k=1;k<NUM_INTS;k++ ) {
a[k] = 2*a[k-1];
} }
for( k=NUM_INTS-1;k>0;k-- ) { for( k=NUM_INTS-1;k>0;k-- ) {
a[k] /= a[k-1]; a[k] -= a[k-1]; // 5 int ops
} }
a[0] /= 2;
for( k=1;k<NUM_INTS;k++ ) { for( k=1;k<NUM_INTS;k++ ) {
a[k] = 2*a[k-1]; a[k] = 2*a[k-1]; // 6 int ops
}
for( k=NUM_INTS-1;k>0;k-- ) {
if( a[k-1] != 0 ) // 7 int ops
a[k] /= a[k-1]; // 8 int ops
}
for( k=1;k<NUM_INTS;k++ ) {
a[k] = 2*a[k-1]; // 9 int ops
} }
} }
} }