File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
lib/node_modules/@stdlib/blas/ext/base/drev/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 }
@@ -115,6 +116,7 @@ static double benchmark1( int iterations, int len ) {
115116 if ( x [ 0 ] != x [ 0 ] ) {
116117 printf ( "should not return NaN\n" );
117118 }
119+ free ( x );
118120 return elapsed ;
119121}
120122
@@ -127,10 +129,11 @@ static double benchmark1( int iterations, int len ) {
127129*/
128130static double benchmark2 ( int iterations , int len ) {
129131 double elapsed ;
130- double x [ len ] ;
132+ double * x ;
131133 double t ;
132134 int i ;
133135
136+ x = (double * ) malloc ( len * sizeof ( double ) );
134137 for ( i = 0 ; i < len ; i ++ ) {
135138 x [ i ] = ( rand_double ()* 200.0 ) - 100.0 ;
136139 }
@@ -146,6 +149,7 @@ static double benchmark2( int iterations, int len ) {
146149 if ( x [ 0 ] != x [ 0 ] ) {
147150 printf ( "should not return NaN\n" );
148151 }
152+ free ( x );
149153 return elapsed ;
150154}
151155
You can’t perform that action at this time.
0 commit comments