Skip to content

Commit d92d041

Browse files
committed
bench: refactor to use dynamic memory allocation at number/uint8/base/add native
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: missing_dependencies - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent bcf97de commit d92d041

File tree

1 file changed

+3
-1
lines changed
  • lib/node_modules/@stdlib/number/uint8/base/add/benchmark/c/native

1 file changed

+3
-1
lines changed

lib/node_modules/@stdlib/number/uint8/base/add/benchmark/c/native/benchmark.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,13 @@ static double rand_double( void ) {
9191
* @return elapsed time in seconds
9292
*/
9393
static double benchmark( void ) {
94-
uint8_t x[ 100 ];
94+
uint8_t *x;
9595
double elapsed;
9696
uint8_t y;
9797
double t;
9898
int i;
9999

100+
x = (uint8_t *) malloc( 100 * sizeof( uint8_t ) );
100101
for ( i = 0; i < 100; i++ ) {
101102
x[ i ] = (uint8_t)( 50.0*rand_double() );
102103
}
@@ -113,6 +114,7 @@ static double benchmark( void ) {
113114
if ( y > 100 ) {
114115
printf( "unexpected value\n" );
115116
}
117+
free( x );
116118
return elapsed;
117119
}
118120

0 commit comments

Comments
 (0)