Skip to content
Snippets Groups Projects
  • Paul Sokolovsky's avatar
    a261d8b6
    py/objarray: Introduce "memview_offset" alias for "free" field of object · a261d8b6
    Paul Sokolovsky authored
    Both mp_type_array and mp_type_memoryview use the same object structure,
    mp_obj_array_t, but for the case of memoryview, some fields, e.g. "free",
    have different meaning.  As the "free" field is also a bitfield, assume
    that (anonymous) union can't be used here (for the concerns of possible
    compatibility issues with wide array of toolchains), and just add a field
    alias using a #define.  As it's a define, it should be a selective
    identifier, so use verbose "memview_offset" to avoid any clashes.
    a261d8b6
    History
    py/objarray: Introduce "memview_offset" alias for "free" field of object
    Paul Sokolovsky authored
    Both mp_type_array and mp_type_memoryview use the same object structure,
    mp_obj_array_t, but for the case of memoryview, some fields, e.g. "free",
    have different meaning.  As the "free" field is also a bitfield, assume
    that (anonymous) union can't be used here (for the concerns of possible
    compatibility issues with wide array of toolchains), and just add a field
    alias using a #define.  As it's a define, it should be a selective
    identifier, so use verbose "memview_offset" to avoid any clashes.