File tree Expand file tree Collapse file tree
lib/node_modules/@stdlib/blas/ext/base/ssumkbn/benchmark/c Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -96,11 +96,11 @@ 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 ;
103-
103+ x = ( float * ) malloc ( len * sizeof ( double ) );
104104 for ( i = 0 ; i < len ; i ++ ) {
105105 x [ i ] = ( rand_float ()* 20000.0f ) - 10000.0f ;
106106 }
@@ -118,6 +118,7 @@ static double benchmark1( int iterations, int len ) {
118118 if ( v != v ) {
119119 printf ( "should not return NaN\n" );
120120 }
121+ free (x );
121122 return elapsed ;
122123}
123124
@@ -130,11 +131,11 @@ static double benchmark1( int iterations, int len ) {
130131*/
131132static double benchmark2 ( int iterations , int len ) {
132133 double elapsed ;
133- float x [ len ] ;
134+ float * x ;
134135 float v ;
135136 double t ;
136137 int i ;
137-
138+ x = ( float * ) malloc ( len * sizeof ( double ) );
138139 for ( i = 0 ; i < len ; i ++ ) {
139140 x [ i ] = ( rand_float ()* 20000.0f ) - 10000.0f ;
140141 }
@@ -152,6 +153,7 @@ static double benchmark2( int iterations, int len ) {
152153 if ( v != v ) {
153154 printf ( "should not return NaN\n" );
154155 }
156+ free (x );
155157 return elapsed ;
156158}
157159
You can’t perform that action at this time.
0 commit comments