Skip to content

Commit bcd2a6e

Browse files
committed
Add function to set ndarray flags
1 parent 3b2c481 commit bcd2a6e

File tree

2 files changed

+21
-0
lines changed
  • lib/node_modules/@stdlib/ndarray/ctor

2 files changed

+21
-0
lines changed

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

+5
Original file line numberDiff line numberDiff line change
@@ -213,4 +213,9 @@ int64_t stdlib_ndarray_flags( const struct ndarray *arr );
213213
*/
214214
int8_t stdlib_ndarray_has_flags( const struct ndarray *arr, const int64_t flags );
215215

216+
/**
217+
* Sets specified ndarray flags.
218+
*/
219+
int8_t stdlib_ndarray_set_flags( const struct ndarray *arr, const int64_t flags );
220+
216221
#endif // !STDLIB_NDARRAY_H

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

+16
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,22 @@ int8_t stdlib_ndarray_has_flags( const struct ndarray *arr, const int64_t flags
214214
return 0;
215215
}
216216

217+
/**
218+
* Sets specified ndarray flags.
219+
*
220+
* ## Notes
221+
*
222+
* - The function does not perform any sanity checks and **assumes** the user knows what s/he is doing.
223+
*
224+
* @param arr input ndarray
225+
* @param flags flags to set
226+
* @return status code
227+
*/
228+
int8_t stdlib_ndarray_set_flags( const struct ndarray *arr, const int64_t flags ) {
229+
arr->flags |= flags;
230+
return 0;
231+
}
232+
217233
/**
218234
* Returns a pointer to a dynamically allocated ndarray.
219235
*

0 commit comments

Comments
 (0)