potocpav / npy-rs

NumPy file format (de-)serialization in Rust
30 stars 7 forks source link

Support for `|` endianness #11

Open ExpHP opened 5 years ago

ExpHP commented 5 years ago

Try the following:

>>> np.save('lol.npy', np.array([1,2,3], dtype=np.dtype('<i1')))

and look at the npy file:

{'descr': '|i1', 'fortran_order': False, 'shape': (3,), }

Numpy always uses | for types where endianness is arbitrary. (these are: |b1, |u1, |i1, and |Sn and |Vn for any n). That makes it impossible to serialize these types from numpy and read them into rust, because the npy crate always expects <.