File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
lib/node_modules/@stdlib/strided/base/smap2/benchmark/c Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -107,12 +107,15 @@ static float addf( const float x, const float y ) {
107107*/
108108static double benchmark ( int iterations , int len ) {
109109 double elapsed ;
110- float x [ len ] ;
111- float y [ len ] ;
112- float z [ len ] ;
110+ float * x ;
111+ float * y ;
112+ float * z ;
113113 double t ;
114114 int i ;
115115
116+ x = (float * )malloc ( len * sizeof ( float ) );
117+ y = (float * )malloc ( len * sizeof ( float ) );
118+ z = (float * )malloc ( len * sizeof ( float ) );
116119 for ( i = 0 ; i < len ; i ++ ) {
117120 x [ i ] = ( rand_float ()* 200.0f ) - 100.0f ;
118121 y [ i ] = ( rand_float ()* 200.0f ) - 100.0f ;
@@ -130,6 +133,9 @@ static double benchmark( int iterations, int len ) {
130133 if ( z [ i %len ] != z [ i %len ] ) {
131134 printf ( "should not return NaN\n" );
132135 }
136+ free ( x );
137+ free ( y );
138+ free ( z );
133139 return elapsed ;
134140}
135141
You can’t perform that action at this time.
0 commit comments