File tree Expand file tree Collapse file tree
lib/node_modules/@stdlib/strided/base/smskmap2/benchmark/c Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -107,14 +107,18 @@ static float addf( const float x, const float y ) {
107107* @return elapsed time in seconds
108108*/
109109static double benchmark ( int iterations , int len ) {
110- uint8_t m [ len ];
111110 double elapsed ;
112- float x [ len ];
113- float y [ len ];
114- float z [ len ];
111+ uint8_t * m ;
112+ float * x ;
113+ float * y ;
114+ float * z ;
115115 double t ;
116116 int i ;
117117
118+ m = (uint8_t * )malloc ( len * sizeof ( uint8_t ) );
119+ x = (float * )malloc ( len * sizeof ( float ) );
120+ y = (float * )malloc ( len * sizeof ( float ) );
121+ z = (float * )malloc ( len * sizeof ( float ) );
118122 for ( i = 0 ; i < len ; i ++ ) {
119123 x [ i ] = ( rand_float ()* 200.0f ) - 100.0f ;
120124 y [ i ] = ( rand_float ()* 200.0f ) - 100.0f ;
@@ -133,6 +137,10 @@ static double benchmark( int iterations, int len ) {
133137 if ( z [ i %len ] != z [ i %len ] ) {
134138 printf ( "should not return NaN\n" );
135139 }
140+ free ( m );
141+ free ( x );
142+ free ( y );
143+ free ( z );
136144 return elapsed ;
137145}
138146
You can’t perform that action at this time.
0 commit comments