class Instruction(_Mapping):
@classmethod
- def integer(cls, value=0, bits=None, byteorder="little"):
+ def integer(cls, value=0, bits=None, byteorder=ByteOrder.LITTLE):
if isinstance(value, (int, bytes)) and not isinstance(bits, int):
raise ValueError(bits)
if isinstance(value, bytes):
if ((len(value) * 8) != bits):
raise ValueError(f"bit length mismatch")
- value = int.from_bytes(value, byteorder=byteorder)
+ value = int.from_bytes(value, byteorder=str(byteorder))
if isinstance(value, int):
value = _SelectableInt(value=value, bits=bits)
def __setitem__(self, key, value):
return self.storage.__setitem__(key, value)
- def bytes(self, byteorder="little"):
+ def bytes(self, byteorder=ByteOrder.LITTLE):
nr_bytes = (len(self.__class__) // 8)
- return int(self).to_bytes(nr_bytes, byteorder=byteorder)
+ return int(self).to_bytes(nr_bytes, byteorder=str(byteorder))
@classmethod
def record(cls, db, entry):
return insn
def disassemble(self, record,
- byteorder="little",
+ byteorder=ByteOrder.LITTLE,
style=Style.NORMAL):
raise NotImplementedError()
PO: _Field = range(0, 6)
@classmethod
- def integer(cls, value, byteorder="little"):
+ def integer(cls, value, byteorder=ByteOrder.LITTLE):
return super().integer(bits=32, value=value, byteorder=byteorder)
@property
return "".join(map(str, bits))
def disassemble(self, record,
- byteorder="little",
+ byteorder=ByteOrder.LITTLE,
style=Style.NORMAL):
if style <= Style.SHORT:
blob = ""
PO: Suffix.PO
@classmethod
- def integer(cls, value, byteorder="little"):
+ def integer(cls, value, byteorder=ByteOrder.LITTLE):
return super().integer(bits=64, value=value, byteorder=byteorder)
@classmethod
- def pair(cls, prefix=0, suffix=0, byteorder="little"):
+ def pair(cls, prefix=0, suffix=0, byteorder=ByteOrder.LITTLE):
def transform(value):
return WordInstruction.integer(value=value,
byteorder=byteorder)[0:32]
return insn
def disassemble(self, record,
- byteorder="little",
+ byteorder=ByteOrder.LITTLE,
style=Style.NORMAL):
def blob(insn):
if style <= Style.SHORT: