File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
lib/node_modules/@stdlib/blas/ext/base/scusumpw/benchmark/c Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -96,11 +96,13 @@ static float rand_float( void ) {
9696*/
9797static double benchmark1 ( int iterations , int len ) {
9898 double elapsed ;
99- float x [ len ] ;
100- float y [ len ] ;
99+ float * x ;
100+ float * y ;
101101 double t ;
102102 int i ;
103103
104+ x = (float * ) malloc ( len * sizeof ( float ) );
105+ y = (float * ) malloc ( len * sizeof ( float ) );
104106 for ( i = 0 ; i < len ; i ++ ) {
105107 x [ i ] = ( rand_float () * 20000.0f ) - 10000.0f ;
106108 y [ i ] = 0.0f ;
@@ -118,6 +120,8 @@ static double benchmark1( int iterations, int len ) {
118120 if ( y [ len - 1 ] != y [ len - 1 ] ) {
119121 printf ( "should not return NaN\n" );
120122 }
123+ free ( x );
124+ free ( y );
121125 return elapsed ;
122126}
123127
@@ -130,11 +134,13 @@ static double benchmark1( int iterations, int len ) {
130134*/
131135static double benchmark2 ( int iterations , int len ) {
132136 double elapsed ;
133- float x [ len ] ;
134- float y [ len ] ;
137+ float * x ;
138+ float * y ;
135139 double t ;
136140 int i ;
137141
142+ x = (float * ) malloc ( len * sizeof ( float ) );
143+ y = (float * ) malloc ( len * sizeof ( float ) );
138144 for ( i = 0 ; i < len ; i ++ ) {
139145 x [ i ] = ( rand_float () * 20000.0f ) - 10000.0f ;
140146 y [ i ] = 0.0f ;
@@ -152,6 +158,8 @@ static double benchmark2( int iterations, int len ) {
152158 if ( y [ len - 1 ] != y [ len - 1 ] ) {
153159 printf ( "should not return NaN\n" );
154160 }
161+ free ( x );
162+ free ( y );
155163 return elapsed ;
156164}
157165
You can’t perform that action at this time.
0 commit comments