Skip to content

Commit cf38d87

Browse files
committed
refactor!: rename stdlib_ndarray_bytelength to stdlib_ndarray_byte_length
This commit renames the byte length method to ensure consistent use of snakecase. BREAKING CHANGE: rename `stdlib_ndarray_bytelength` to `stdlib_ndarray_byte_length` To migrate, users using the C API should update their call signatures accordingly. --- 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: passed - 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: passed - task: lint_c_examples status: passed - task: lint_c_benchmarks status: passed - 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 40c30fb commit cf38d87

5 files changed

Lines changed: 14 additions & 14 deletions

File tree

lib/node_modules/@stdlib/ndarray/ctor/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ Notes:
882882
- The user is responsible for freeing the allocated memory.
883883
- To allocate a zero-dimensional ndarray, provide a `shape` argument equal to a null pointer, an `ndims` argument equal to `0`, and a `strides` argument consisting of a single element equal to `0`. The `order` argument can be either row-major or column-major and has no effect on data storage or access.
884884

885-
#### stdlib_ndarray_bytelength( \*arr )
885+
#### stdlib_ndarray_byte_length( \*arr )
886886

887887
Returns the size of an ndarray (in bytes).
888888

@@ -904,7 +904,7 @@ if ( x == NULL ) {
904904
// ...
905905

906906
// Retrieve the ndarray size:
907-
int64_t N = stdlib_ndarray_bytelength( x );
907+
int64_t N = stdlib_ndarray_byte_length( x );
908908

909909
// ...
910910

@@ -917,7 +917,7 @@ The function accepts the following arguments:
917917
- **arr**: `[in] struct ndarray*` input ndarray.
918918

919919
```c
920-
int64_t stdlib_ndarray_bytelength( const struct ndarray *arr );
920+
int64_t stdlib_ndarray_byte_length( const struct ndarray *arr );
921921
```
922922
923923
#### stdlib_ndarray_data( \*arr )
@@ -3415,7 +3415,7 @@ int main( void ) {
34153415
34163416
printf( "dtype = %u\n", stdlib_ndarray_dtype( x1 ) );
34173417
printf( "length = %"PRId64"\n", stdlib_ndarray_length( x1 ) );
3418-
printf( "byteLength = %"PRId64"\n", stdlib_ndarray_bytelength( x1 ) );
3418+
printf( "byteLength = %"PRId64"\n", stdlib_ndarray_byte_length( x1 ) );
34193419
printf( "ltr = %u\n", stdlib_ndarray_dtype_char( stdlib_ndarray_dtype( x1 ) ) );
34203420
printf( "\n" );
34213421
@@ -3428,7 +3428,7 @@ int main( void ) {
34283428
34293429
printf( "dtype = %u\n", stdlib_ndarray_dtype( x2 ) );
34303430
printf( "length = %"PRId64"\n", stdlib_ndarray_length( x2 ) );
3431-
printf( "byteLength = %"PRId64"\n", stdlib_ndarray_bytelength( x2 ) );
3431+
printf( "byteLength = %"PRId64"\n", stdlib_ndarray_byte_length( x2 ) );
34323432
printf( "ltr = %u\n", stdlib_ndarray_dtype_char( stdlib_ndarray_dtype( x2 ) ) );
34333433
printf( "\n" );
34343434

lib/node_modules/@stdlib/ndarray/ctor/benchmark/c/benchmark.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ static double benchmark2( void ) {
158158
t = tic();
159159
for ( i = 0; i < ITERATIONS; i++ ) {
160160
// NOTE: this is likely to be optimized away by a modern compiler, making this benchmark meaningless.
161-
v = stdlib_ndarray_bytelength( arr );
161+
v = stdlib_ndarray_byte_length( arr );
162162
if ( v != 6 ) {
163163
printf( "unexpected result\n" );
164164
break;
@@ -180,8 +180,8 @@ static double benchmark2( void ) {
180180
* @return elapsed time in seconds
181181
*/
182182
static double benchmark3( void ) {
183+
const uint8_t *v;
183184
double elapsed;
184-
uint8_t *v;
185185
double t;
186186
int i;
187187

@@ -487,8 +487,8 @@ static double benchmark9( void ) {
487487
* @return elapsed time in seconds
488488
*/
489489
static double benchmark10( void ) {
490+
const int64_t *v;
490491
double elapsed;
491-
int64_t *v;
492492
double t;
493493
int i;
494494

@@ -531,8 +531,8 @@ static double benchmark10( void ) {
531531
* @return elapsed time in seconds
532532
*/
533533
static double benchmark11( void ) {
534+
const int64_t *v;
534535
double elapsed;
535-
int64_t *v;
536536
double t;
537537
int i;
538538

@@ -3091,8 +3091,8 @@ static double benchmark62( void ) {
30913091
* @return elapsed time in seconds
30923092
*/
30933093
static double benchmark63( void ) {
3094+
const int8_t *v;
30943095
double elapsed;
3095-
int8_t *v;
30963096
double t;
30973097
int i;
30983098

lib/node_modules/@stdlib/ndarray/ctor/examples/c/example.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ int main( void ) {
9999

100100
printf( "dtype = %d\n", stdlib_ndarray_dtype( x1 ) );
101101
printf( "length = %"PRId64"\n", stdlib_ndarray_length( x1 ) );
102-
printf( "byteLength = %"PRId64"\n", stdlib_ndarray_bytelength( x1 ) );
102+
printf( "byteLength = %"PRId64"\n", stdlib_ndarray_byte_length( x1 ) );
103103
printf( "ltr = %u\n", stdlib_ndarray_dtype_char( stdlib_ndarray_dtype( x1 ) ) );
104104
printf( "\n" );
105105

@@ -112,7 +112,7 @@ int main( void ) {
112112

113113
printf( "dtype = %d\n", stdlib_ndarray_dtype( x2 ) );
114114
printf( "length = %"PRId64"\n", stdlib_ndarray_length( x2 ) );
115-
printf( "byteLength = %"PRId64"\n", stdlib_ndarray_bytelength( x2 ) );
115+
printf( "byteLength = %"PRId64"\n", stdlib_ndarray_byte_length( x2 ) );
116116
printf( "ltr = %u\n", stdlib_ndarray_dtype_char( stdlib_ndarray_dtype( x2 ) ) );
117117
printf( "\n" );
118118

lib/node_modules/@stdlib/ndarray/ctor/include/stdlib/ndarray/ctor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ struct ndarray * stdlib_ndarray_allocate( int16_t dtype, uint8_t *data, int64_t
4646
/**
4747
* Returns the size of an ndarray (in bytes).
4848
*/
49-
int64_t stdlib_ndarray_bytelength( const struct ndarray *arr );
49+
int64_t stdlib_ndarray_byte_length( const struct ndarray *arr );
5050

5151
/**
5252
* Returns a pointer to an ndarray's underlying byte array.

lib/node_modules/@stdlib/ndarray/ctor/src/main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ struct ndarray * stdlib_ndarray_allocate( int16_t dtype, uint8_t *data, int64_t
158158
* @param arr input ndarray
159159
* @return array size
160160
*/
161-
int64_t stdlib_ndarray_bytelength( const struct ndarray *arr ) {
161+
int64_t stdlib_ndarray_byte_length( const struct ndarray *arr ) {
162162
return arr->byteLength;
163163
}
164164

0 commit comments

Comments
 (0)