Skip to content

Commit f7ff9ea

Browse files
committed
Update dtypes
1 parent 21d1828 commit f7ff9ea

File tree

2 files changed

+46
-27
lines changed
  • lib/node_modules/@stdlib/ndarray/dtypes

2 files changed

+46
-27
lines changed

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,13 @@ extern "C" {
3030
* Enumeration of underlying ndarray data types.
3131
*/
3232
enum STDLIB_NDARRAY_DTYPE {
33-
// STDLIB_NDARRAY_BOOL = 0, // TODO: uncomment once supported
33+
// Boolean data types:
34+
STDLIB_NDARRAY_BOOL = 0,
3435

35-
STDLIB_NDARRAY_INT8 = 0, // NOTE: remove explicitly setting value once `bool` supported
36+
// Integer data types:
37+
STDLIB_NDARRAY_INT8,
3638
STDLIB_NDARRAY_UINT8,
39+
STDLIB_NDARRAY_UINT8C,
3740
STDLIB_NDARRAY_INT16,
3841
STDLIB_NDARRAY_UINT16,
3942
STDLIB_NDARRAY_INT32,
@@ -45,11 +48,22 @@ enum STDLIB_NDARRAY_DTYPE {
4548
// STDLIB_NDARRAY_INT256,
4649
// STDLIB_NDARRAY_UINT256,
4750

51+
// Floating-point data types:
4852
// STDLIB_NDARRAY_FLOAT16, // TODO: uncomment once supported
4953
STDLIB_NDARRAY_FLOAT32,
5054
STDLIB_NDARRAY_FLOAT64,
5155
// STDLIB_NDARRAY_FLOAT128 // TODO: uncomment once supported
5256

57+
// Complex floating-point number data types:
58+
// STDLIB_NDARRAY_COMPLEX64, // TODO: uncomment once supported
59+
// STDLIB_NDARRAY_COMPLEX128,
60+
61+
// Define a data type for "binary" data (i.e., data stored in a Node.js `Buffer` object):
62+
STDLIB_NDARRAY_BINARY,
63+
64+
// Define a data type for "generic" JavaScript values (objects):
65+
STDLIB_NDARRAY_GENERIC,
66+
5367
// "Compute" the number of data types (this works because of how `enum` works: the value is automatically set to the last enumerated type plus 1):
5468
STDLIB_NDARRAY_NDTYPES,
5569

lib/node_modules/@stdlib/ndarray/dtypes/lib/enum.js

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -39,37 +39,42 @@
3939
function enumerated() {
4040
// NOTE: the following should match the C `dtypes.h` enumeration!!!!
4141
return {
42-
// 'bool': 0, // uncomment once supported
42+
// Boolean data types:
43+
'bool': 0,
4344

44-
'int8': 0,
45-
'uint8': 1,
46-
'int16': 2,
47-
'uint16': 3,
48-
'int32': 4,
49-
'uint32': 5,
50-
'int64': 6,
51-
'uint64': 7,
52-
// 'int128': 9, // uncomment once supported
53-
// 'uint128': 10, // uncomment once supported
54-
// 'int256': 11, // uncomment once supported
55-
// 'uint256': 12, // uncomment once supported
45+
// Integer data types:
46+
'int8': 1,
47+
'uint8': 2,
48+
'uint8c': 3,
49+
'int16': 4,
50+
'uint16': 5,
51+
'int32': 6,
52+
'uint32': 7,
53+
'int64': 8,
54+
'uint64': 9,
55+
// 'int128': 10, // uncomment once supported
56+
// 'uint128': 11,
57+
// 'int256': 12,
58+
// 'uint256': 13,
5659

57-
// 'float16': 13, // uncomment once supported
58-
'float32': 8,
59-
'float64': 9,
60-
// 'float128': 16, // uncomment once supported
60+
// Floating-point data types:
61+
// 'float16': 14,
62+
'float32': 10,
63+
'float64': 11,
64+
// 'float128': 17, // uncomment once supported
6165

62-
// Define a signaling value which is guaranteed not to be a valid type enumeration value:
63-
'notype': 11,
66+
// Complex floating-point number data types:
67+
// 'complex64': 18, // uncomment once supported
68+
// 'complex128': 19,
6469

65-
// The following is a special dtype, which is, in more recent Node.js versions, effectively equivalent to `uint8` when calling into C; however, in older Node.js versions, the `Buffer` object was not based on the `Uint8Array` typed array. Here, we treat "binary" as an alias for `uint8`.
66-
'binary': 1,
70+
// Data type for "binary" data (i.e., data stored in a Node.js `Buffer` object):
71+
'binary': 12,
6772

68-
// The following is a special dtype which is only applicable in JavaScript, not in C. Here, we treat "uint8c" as an alias for `uint8`.
69-
'uint8c': 1,
73+
// Data type for "generic" JavaScript values (objects):
74+
'generic': 13,
7075

71-
// The following corresponds to a "generic" JavaScript `Array` instance. This has no equivalent native C type.
72-
'generic': 11,
76+
// Define a signaling value which is guaranteed not to be a valid type enumeration value:
77+
'notype': 15,
7378

7479
// Indicate the start of user defined type numbers (leaving room for type growth above):
7580
'userdefined_type': 256

0 commit comments

Comments
 (0)