File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
lib/node_modules/@stdlib/blas/base/snrm2/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 z ;
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 }
@@ -117,6 +118,7 @@ static double benchmark1( int iterations, int len ) {
117118 if ( z != z ) {
118119 printf ( "should not return NaN\n" );
119120 }
121+ free ( x );
120122 return elapsed ;
121123}
122124
@@ -129,11 +131,12 @@ static double benchmark1( int iterations, int len ) {
129131*/
130132static double benchmark2 ( int iterations , int len ) {
131133 double elapsed ;
132- float x [ len ] ;
134+ float * x ;
133135 float z ;
134136 double t ;
135137 int i ;
136138
139+ x = (float * )malloc ( len * sizeof ( float ) );
137140 for ( i = 0 ; i < len ; i ++ ) {
138141 x [ i ] = ( rand_float () * 20000.0f ) - 10000.0f ;
139142 }
@@ -150,6 +153,7 @@ static double benchmark2( int iterations, int len ) {
150153 if ( z != z ) {
151154 printf ( "should not return NaN\n" );
152155 }
156+ free ( x );
153157 return elapsed ;
154158}
155159
You can’t perform that action at this time.
0 commit comments