extmod/moductypes: Add calc_offsets() to automatically calc field offsets.
extmod/moductypes: Add calc_offsets() to automatically calc field offsets.

To use this function, a structure descriptor should be done using OrderDict,
and no offsets need to be specified, calc_offsets() will fill them in based
on the layout type. For example:

desc = OrderedDict((
("f1", uctypes.UINT8),
("f1", uctypes.UINT16),
))
uctypes.calc_offsets(desc, ctypes.LITTLE_ENDIAN)

While doing this, structure size calculation for native layout was also
fixed - rounding up of structure size depends not on max field size, but
on max field alignment. For example, on x86, alignment of UINT64 is 4,
so a structure of UINT32 and UINT64 has size of 12 (and not 16, as was
calculated previously).

pfalcon/micropython,pfalcon/micropython,pfalcon/micropython,pfalcon/micropython,pfalcon/micropython