def _iter_enum_member_values(eid, bitmask):
    """Iterate member values with given bitmask inside the enum

    Note that `DEFMASK` can either indicate end-of-values or a valid value.
    Iterate serials to tell apart.
    """
    value = idaapi.get_first_enum_member(eid, bitmask)

    yield value
    while value != DEFMASK:
        value = idaapi.get_next_enum_member(eid, value, bitmask)
        yield value