File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
lib/node_modules/@stdlib/blas/ext/base/ssumkbn/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,11 +96,12 @@ static float rand_float( void ) {
9696*/
9797static double benchmark1 ( int iterations , int len ) {
9898 double elapsed ;
99- float x [ len ] ;
99+ float * x ;
100100 float v ;
101101 double t ;
102102 int i ;
103103
104+ x = (float * ) malloc ( len * sizeof ( float ) );
104105 for ( i = 0 ; i < len ; i ++ ) {
105106 x [ i ] = ( rand_float ()* 20000.0f ) - 10000.0f ;
106107 }
@@ -118,6 +119,7 @@ static double benchmark1( int iterations, int len ) {
118119 if ( v != v ) {
119120 printf ( "should not return NaN\n" );
120121 }
122+ free ( x );
121123 return elapsed ;
122124}
123125
@@ -130,11 +132,12 @@ static double benchmark1( int iterations, int len ) {
130132*/
131133static double benchmark2 ( int iterations , int len ) {
132134 double elapsed ;
133- float x [ len ] ;
135+ float * x ;
134136 float v ;
135137 double t ;
136138 int i ;
137139
140+ x = (float * ) malloc ( len * sizeof ( float ) );
138141 for ( i = 0 ; i < len ; i ++ ) {
139142 x [ i ] = ( rand_float ()* 20000.0f ) - 10000.0f ;
140143 }
@@ -152,6 +155,7 @@ static double benchmark2( int iterations, int len ) {
152155 if ( v != v ) {
153156 printf ( "should not return NaN\n" );
154157 }
158+ free ( x );
155159 return elapsed ;
156160}
157161
You can’t perform that action at this time.
0 commit comments