| 10805 | return f"<StructuredDataValue type:{self.type} value:{self}>" |
| 10806 | |
| 10807 | def __int__(self): |
| 10808 | if self.type.width == 1: |
| 10809 | code = "B" |
| 10810 | elif self.type.width == 2: |
| 10811 | code = "H" |
| 10812 | elif self.type.width == 4: |
| 10813 | code = "I" |
| 10814 | elif self.type.width == 8: |
| 10815 | code = "Q" |
| 10816 | else: |
| 10817 | raise Exception("Could not convert to integer with width {}".format(self.type.width)) |
| 10818 | |
| 10819 | endian = "<" if self.endian == Endianness.LittleEndian else ">" |
| 10820 | return struct.unpack(f"{endian}{code}", self.value)[0] |
| 10821 | |
| 10822 | @property |
| 10823 | def str(self) -> str: |