File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
lib/node_modules/@stdlib/blas/ext/base/dapx/benchmark/c Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -96,10 +96,11 @@ static double rand_double( void ) {
9696*/
9797static double benchmark1 ( int iterations , int len ) {
9898 double elapsed ;
99- double x [ len ] ;
99+ double * x ;
100100 double t ;
101101 int i ;
102102
103+ x = (double * )malloc ( len * sizeof (double ) );
103104 for ( i = 0 ; i < len ; i ++ ) {
104105 x [ i ] = ( rand_double ()* 200.0 ) - 100.0 ;
105106 }
@@ -116,15 +117,17 @@ static double benchmark1( int iterations, int len ) {
116117 if ( x [ 0 ] != x [ 0 ] ) {
117118 printf ( "should not return NaN\n" );
118119 }
120+ free ( x );
119121 return elapsed ;
120122}
121123
122124static double benchmark2 ( int iterations , int len ) {
123125 double elapsed ;
124- double x [ len ] ;
126+ double * x ;
125127 double t ;
126128 int i ;
127129
130+ x = (double * )malloc ( len * sizeof (double ) );
128131 for ( i = 0 ; i < len ; i ++ ) {
129132 x [ i ] = ( rand_double ()* 200.0 ) - 100.0 ;
130133 }
@@ -141,6 +144,7 @@ static double benchmark2( int iterations, int len ) {
141144 if ( x [ 0 ] != x [ 0 ] ) {
142145 printf ( "should not return NaN\n" );
143146 }
147+ free ( x );
144148 return elapsed ;
145149}
146150
You can’t perform that action at this time.
0 commit comments