File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
lib/node_modules/@stdlib/blas/ext/base/sapx/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 float rand_float( void ) {
9696*/
9797static double benchmark1 ( int iterations , int len ) {
9898 double elapsed ;
99- float x [ len ] ;
99+ float * x ;
100100 double t ;
101101 int i ;
102102
103+ x = (float * )malloc ( len * sizeof ( float ) );
103104 for ( i = 0 ; i < len ; i ++ ) {
104105 x [ i ] = ( rand_float ()* 200.0f ) - 100.0f ;
105106 }
@@ -116,6 +117,7 @@ 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
@@ -128,10 +130,11 @@ static double benchmark1( int iterations, int len ) {
128130*/
129131static double benchmark2 ( int iterations , int len ) {
130132 double elapsed ;
131- float x [ len ] ;
133+ float * x ;
132134 double t ;
133135 int i ;
134136
137+ x = (float * )malloc ( len * sizeof ( float ) );
135138 for ( i = 0 ; i < len ; i ++ ) {
136139 x [ i ] = ( rand_float ()* 200.0f ) - 100.0f ;
137140 }
@@ -148,6 +151,7 @@ static double benchmark2( int iterations, int len ) {
148151 if ( x [ 0 ] != x [ 0 ] ) {
149152 printf ( "should not return NaN\n" );
150153 }
154+ free ( x );
151155 return elapsed ;
152156}
153157
You can’t perform that action at this time.
0 commit comments