@@ -201,3 +201,70 @@ pub struct npy_stride_sort_item {
201
201
pub perm : npy_intp ,
202
202
pub stride : npy_intp ,
203
203
}
204
+
205
+ #[ repr( u8 ) ]
206
+ #[ derive( Debug , Clone , Copy ) ]
207
+ enum NPY_TYPECHAR {
208
+ NPY_BOOLLTR = b'?' ,
209
+ NPY_BYTELTR = b'b' ,
210
+ NPY_UBYTELTR = b'B' ,
211
+ NPY_SHORTLTR = b'h' ,
212
+ NPY_USHORTLTR = b'H' ,
213
+ NPY_INTLTR = b'i' ,
214
+ NPY_UINTLTR = b'I' ,
215
+ NPY_LONGLTR = b'l' ,
216
+ NPY_ULONGLTR = b'L' ,
217
+ NPY_LONGLONGLTR = b'q' ,
218
+ NPY_ULONGLONGLTR = b'Q' ,
219
+ NPY_HALFLTR = b'e' ,
220
+ NPY_FLOATLTR = b'f' ,
221
+ NPY_DOUBLELTR = b'd' ,
222
+ NPY_LONGDOUBLELTR = b'g' ,
223
+ NPY_CFLOATLTR = b'F' ,
224
+ NPY_CDOUBLELTR = b'D' ,
225
+ NPY_CLONGDOUBLELTR = b'G' ,
226
+ NPY_OBJECTLTR = b'O' ,
227
+ NPY_STRINGLTR = b'S' ,
228
+ NPY_STRINGLTR2 = b'a' ,
229
+ NPY_UNICODELTR = b'U' ,
230
+ NPY_VOIDLTR = b'V' ,
231
+ NPY_DATETIMELTR = b'M' ,
232
+ NPY_TIMEDELTALTR = b'm' ,
233
+ NPY_CHARLTR = b'c' ,
234
+ NPY_INTPLTR = b'p' ,
235
+ NPY_UINTPLTR = b'P' ,
236
+ }
237
+
238
+ #[ repr( u8 ) ]
239
+ #[ derive( Debug , Clone , Copy ) ]
240
+ // NPY_TYPEKINDCHAR doesn't exist in the header, but these enum values are not
241
+ // related to NPY_TYPECHAR although being stuffed into it (type kinds, not type codes)
242
+ enum NPY_TYPEKINDCHAR {
243
+ NPY_GENBOOLLTR = b'b' ,
244
+ NPY_SIGNEDLTR = b'i' ,
245
+ NPY_UNSIGNEDLTR = b'u' ,
246
+ NPY_FLOATINGLTR = b'f' ,
247
+ NPY_COMPLEXLTR = b'c' ,
248
+ }
249
+
250
+ #[ repr( u8 ) ]
251
+ #[ derive( Debug , Copy , Clone , PartialEq , Eq , Hash ) ]
252
+ pub enum NPY_BYTEORDER_CHAR {
253
+ NPY_LITTLE = b'<' ,
254
+ NPY_BIG = b'>' ,
255
+ NPY_NATIVE = b'=' ,
256
+ NPY_SWAP = b's' ,
257
+ NPY_IGNORE = b'|' ,
258
+ }
259
+
260
+ impl NPY_BYTEORDER_CHAR {
261
+ #[ cfg( target_endian = "little" ) ]
262
+ pub const NPY_NATBYTE : Self = Self :: NPY_LITTLE ;
263
+ #[ cfg( target_endian = "little" ) ]
264
+ pub const NPY_OPPBYTE : Self = Self :: NPY_BIG ;
265
+
266
+ #[ cfg( target_endian = "big" ) ]
267
+ pub const NPY_NATBYTE : Self = Self :: NPY_BIG ;
268
+ #[ cfg( target_endian = "big" ) ]
269
+ pub const NPY_OPPBYTE : Self = Self :: NPY_LITTLE ;
270
+ }
0 commit comments