if isinstance(opcode, (int, PatternOpcode)):
return opcode
assert isinstance(opcode, str)
- assert opcode.startswith('0b')
+ if len(opcode) > 4 or '-' in opcode:
+ # all binary numbers must start with 0b
+ assert opcode.startswith('0b')
if '-' not in opcode:
opcode = int(opcode, 0)
else: