def make_operand_mask(mask_string):
    """
    Convert a binary mask string with variable characters and bits to an '&', and '==' mask.
    This is used to be able to match an instruction word to the instruction table entry.
    """
    and_mask = cmp_mask = 0
    for c in mask_string:
        and_mask <<= 1
        cmp_mask <<= 1
        if c == '0':
            and_mask |= 1
        elif c == '1':
            and_mask |= 1
            cmp_mask |= 1
    return and_mask, cmp_mask