Skip to content

Commit 254ba4a

Browse files
committed
Consolidate if statements
1 parent 8445487 commit 254ba4a

File tree

1 file changed

+8
-7
lines changed
  • lib/node_modules/@stdlib/ndarray/ctor/src

1 file changed

+8
-7
lines changed

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

+8-7
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,14 @@ struct ndarray * stdlib_ndarray_constructor( uint8_t *data, uint64_t ndims, int6
130130
contiguous = 0;
131131
}
132132
}
133-
// Determine if the array is row-major contiguous:
134-
if ( contiguous == 1 && ( ord == 1 || ord == 3 ) ) {
135-
arr->flags |= STDLIB_NDARRAY_ROW_MAJOR_CONTIGUOUS_FLAG;
136-
}
137-
// Determine if the array is column-major contiguous:
138-
if ( contiguous == 1 && ( ord == 2 || ord == 3 ) ) {
139-
arr->flags |= STDLIB_NDARRAY_COLUMN_MAJOR_CONTIGUOUS_FLAG;
133+
// Determine if the array is row-major/column-major contiguous:
134+
if ( contiguous == 1 ) {
135+
if ( ord == 1 || ord == 3 ) {
136+
arr->flags |= STDLIB_NDARRAY_ROW_MAJOR_CONTIGUOUS_FLAG;
137+
}
138+
if ( ord == 2 || ord == 3 ) {
139+
arr->flags |= STDLIB_NDARRAY_COLUMN_MAJOR_CONTIGUOUS_FLAG;
140+
}
140141
}
141142

142143
return arr;

0 commit comments

Comments
 (0)