[Numpy-discussion] Struct alignment
Sat Apr 18 10:53:52 CDT 2009
On Sat, Apr 18, 2009 at 10:36 PM, Dag Sverre Seljebotn
> I'm looking at fixing up support for NumPy record arrays in Cython, and
> realize my knowledge of NumPy is a bit too limited. Searching the docs
> didn't enlighten me, so:
> Does NumPy always use packed alignment for nested dtypes?
No, you may have to pad "manually" depending on what you want.
Sometimes, the align argument is enough, though:
a = dtype([('f0', '<f4'), ('f1', '|i1'), ('f2', '<i4')], align=True)
a.itemsize # 12 on 32 bits arch
More information about the Numpy-discussion