File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
tools/snippets/benchmark/c/native Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 3434*/
3535static void print_version ( void );
3636static void print_summary ( int total , int passing );
37- static void print_results ( double elapsed );
37+ static void print_results ( int iterations , double elapsed );
3838static double tic ( void );
3939static float rand_float ( void );
4040static double rand_double ( void );
@@ -117,11 +117,12 @@ static double rand_double( void ) {
117117*/
118118static double benchmark ( int iterations , int len ) {
119119 double elapsed ;
120- double x [ len ] ;
120+ double * x ;
121121 double y ;
122122 double t ;
123123 int i ;
124124
125+ x = (double * ) malloc ( len * sizeof ( double ) );
125126 for ( i = 0 ; i < len ; i ++ ) {
126127 x [ i ] = ( rand_double ()* 20000.0 ) - 10000.0 ;
127128 }
@@ -137,6 +138,7 @@ static double benchmark( int iterations, int len ) {
137138 if ( TODO ) {
138139 printf ( "unexpected return value\n" );
139140 }
141+ free ( x );
140142 return elapsed ;
141143}
142144
You can’t perform that action at this time.
0 commit comments