Restructuration of the code to use cfg files, arguments, and multiple
smaller modules
This commit is contained in:
parent
3e665cd11a
commit
9cc805fb9d
10 changed files with 3235 additions and 256 deletions
10
utils.py
Normal file
10
utils.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
def hex_address_to_memory_representation(hex_addr: str, is_32b: bool, is_little_endian: bool) -> list[int]:
|
||||
adress_size = 4 if is_32b else 8
|
||||
mem_value = [0x00] * adress_size
|
||||
hex_addr = hex_addr[::-1][:-2] # reversing order and stripping zero
|
||||
for i in range(0, adress_size):
|
||||
byte_str = hex_addr[i * 2 : (i + 1) * 2][::-1]
|
||||
mem_value[i] += int(byte_str, 16)
|
||||
if not is_little_endian:
|
||||
mem_value = mem_value[::-1] # reverse byte order for big endian
|
||||
return mem_value
|
||||
Loading…
Add table
Add a link
Reference in a new issue