File tree Expand file tree Collapse file tree
lib/node_modules/@stdlib/blas/ext/base/ssumors/benchmark/c Expand file tree Collapse file tree 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,16 +119,18 @@ 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
124126static double benchmark2 ( int iterations , int len ) {
125127 double elapsed ;
126- float x [ len ] ;
128+ float * x ;
127129 float v ;
128130 double t ;
129131 int i ;
130132
133+ x = (float * ) malloc ( len * sizeof ( float ) );
131134 for ( i = 0 ; i < len ; i ++ ) {
132135 x [ i ] = ( rand_float ()* 20000.0f ) - 10000.0f ;
133136 }
@@ -145,6 +148,7 @@ static double benchmark2( int iterations, int len ) {
145148 if ( v != v ) {
146149 printf ( "should not return NaN\n" );
147150 }
151+ free ( x );
148152 return elapsed ;
149153}
150154
You can’t perform that action at this time.
0 commit comments